Spaces:
Sleeping
Sleeping
| import os | |
| import shutil | |
| def move_files(source_folder, destination_folder, filetype = "pdf"): | |
| if not os.path.exists(destination_folder): | |
| os.makedirs(destination_folder) | |
| # print(os.listdir(source_folder)) | |
| for filename in os.listdir(source_folder): | |
| if filename.lower().endswith(f'.{filetype}'): | |
| source_file = os.path.join(source_folder, filename) | |
| destination_file = os.path.join(destination_folder, filename) | |
| shutil.move(source_file, destination_file) | |
| print(f"Moved {filename} to {destination_folder}") | |