Add create folders function
This commit is contained in:
parent
ecc668f719
commit
7bbd538d2f
@ -12,3 +12,22 @@ def find_shp_files(root_folder):
|
|||||||
shp_files.append(new_file_name)
|
shp_files.append(new_file_name)
|
||||||
return shp_files
|
return shp_files
|
||||||
|
|
||||||
|
|
||||||
|
def create_folders(directory, num_folders):
|
||||||
|
"""
|
||||||
|
Create a specified number of folders in the given directory.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
- directory (str): The directory where folders will be created.
|
||||||
|
- num_folders (int): The number of folders to create.
|
||||||
|
"""
|
||||||
|
# Check if the directory exists, if not, create it
|
||||||
|
if not os.path.exists(directory):
|
||||||
|
os.makedirs(directory)
|
||||||
|
|
||||||
|
# Create folders
|
||||||
|
for i in range(num_folders):
|
||||||
|
folder_name = f"layer_{i}"
|
||||||
|
folder_path = os.path.join(directory, folder_name)
|
||||||
|
os.makedirs(folder_path)
|
||||||
|
print(f"Created folder: {folder_path}")
|
Loading…
Reference in New Issue
Block a user