|
|
|
@@ -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)
|
|
|
|
|
|
|
|
|