Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import shutil
- # Specify the source and destination directories
- source_directory = r"C:\Scripts\File Mover\Files to Be Moved"
- destination_directory = r"\\TARVOS\Shared\Desktop\Byte Vault\FLAC"
- # Check if the source directory exists
- if os.path.exists(source_directory) and os.path.isdir(source_directory):
- # Get a list of all subdirectories in the source directory
- subdirectories = [d for d in os.listdir(source_directory) if os.path.isdir(os.path.join(source_directory, d))]
- # Move each subdirectory to the destination directory
- print("Moving your albums:\n")
- for subdirectory in subdirectories:
- source_path = os.path.join(source_directory, subdirectory)
- destination_path = os.path.join(destination_directory, subdirectory)
- try:
- shutil.move(source_path, destination_path)
- print(f"Moved '{subdirectory}'")
- except Exception as e:
- print(f"Error moving {source_path}: {str(e)}")
- else:
- print(f"Source directory does not exist: {source_directory}")
- # Opening the directory:
- os.startfile(destination_directory)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement