Compare commits

...

2 Commits

Author SHA1 Message Date
67e68da880 added TODO 2025-10-04 12:18:00 +02:00
8df12ec6f4 fixed numbering in recursion 2025-10-04 12:16:59 +02:00
3 changed files with 17 additions and 13 deletions

View File

@@ -25,6 +25,8 @@ n -> valid input check back for no arguments passed?
## Changelog ## Changelog
<2025-10-04> V0.3.4 - Added recursive directory creation and fixed
numbered naming
<2025-10-03> V0.3.3 - Added the beginning of recursive mode <2025-10-03> V0.3.3 - Added the beginning of recursive mode
<2025-09-30> V0.3.2 - Refactoring librefit and added proper docstrings; <2025-09-30> V0.3.2 - Refactoring librefit and added proper docstrings;
begun to remove the check for the valid input and put it in the decider begun to remove the check for the valid input and put it in the decider

View File

@@ -24,14 +24,14 @@ def get_standard_name_number(current_number: int, number_str_length: int) -> str
>>> get_standard_name_number(23, 4) >>> get_standard_name_number(23, 4)
'0023' '0023'
""" """
# logger.debug( logger.debug(
# f"FUNC: get_standard_name_number() index={current_number} string_length={number_str_length}" f"FUNC: get_standard_name_number() index={current_number} string_length={number_str_length}"
# ) )
temp_current_number = str(current_number) temp_current_number = str(current_number)
standard_name_number = str.zfill(temp_current_number, number_str_length) standard_name_number = str.zfill(temp_current_number, number_str_length)
# logger.debug( logger.debug(
# f"FUNC: get_standard_name_number() return value= '{standard_name_number}'" f"FUNC: get_standard_name_number() return value= '{standard_name_number}'"
# ) )
return standard_name_number return standard_name_number
@@ -145,26 +145,31 @@ def get_current_path(path) -> str:
sys.exit(1) sys.exit(1)
# FIXME: the assigning of the number to the folders is not working
# TODO: - add logging # TODO: - add logging
# - add docstring # - add docstring
# - add proper naming to the files
def create_recursive_folders(input_path, target_depth, current_depth, width): def create_recursive_folders(input_path, target_depth, current_depth, width):
"""Creates a recursive directory structure with y as depth and x as width""" """Creates a recursive directory structure with y as depth and x as width"""
# Exits the recursion if the target depth is reached.
if current_depth >= target_depth: if current_depth >= target_depth:
return return
# Getting the lenth of the number string which gets added to the dir name.
length_width = len(str(width)) length_width = len(str(width))
logger.debug( logger.debug(
f"FUNC: create_recursive_folders(length_width) MSG: length_width='{length_width}'" f"FUNC: create_recursive_folders(length_width) MSG: given values: path={input_path} target_depth={target_depth} current_depth={current_depth}, with={width}"
) )
# Creates the directories of the current depth
for i in range(width): for i in range(width):
# Getting the numbering of the folder.
folder_index = i + 1 folder_index = i + 1
new_directory_name = "sub_dir" + get_standard_name_number( new_directory_name = "sub_dir" + get_standard_name_number(
length_width, folder_index folder_index, length_width
) )
new_directory_path = os.path.join(input_path, new_directory_name) new_directory_path = os.path.join(input_path, new_directory_name)
os.mkdir(new_directory_path)
print(new_directory_path) print(new_directory_path)
logger.debug(f"New Path: path={new_directory_path}") logger.debug(f"New Path: path={new_directory_path}")
@@ -174,6 +179,3 @@ def create_recursive_folders(input_path, target_depth, current_depth, width):
current_depth + 1, current_depth + 1,
width, width,
) )
# create_recursive_folders(".", 2, 0, 3)

View File

@@ -1,5 +1,5 @@
[VERSION] [VERSION]
major = 0 major = 0
minor = 3 minor = 3
patch = 3 patch = 4