buenzliai/copyFiles.py
2024-06-04 03:47:40 +02:00

30 lines
No EOL
926 B
Python

import os
import shutil
def copy_files_to_root(src_folder, dest_root):
# Check if source folder exists
if not os.path.exists(src_folder):
print(f"Source folder '{src_folder}' does not exist.")
return
# Create destination root folder if it does not exist
if not os.path.exists(dest_root):
os.makedirs(dest_root)
# Copy files
for item in os.listdir(src_folder):
src_path = os.path.join(src_folder, item)
dest_path = os.path.join(dest_root, item)
if os.path.isfile(src_path):
shutil.copy2(src_path, dest_path)
print(f"Copied '{src_path}' to '{dest_path}'")
else:
print(f"Skipped '{src_path}' as it is not a file")
# Define source folder and destination root
src_folder = 'C:/Users/Marcel/CLionProjects/BuenzliIO/assets'
dest_root = 'D:/'
# Execute the copy function
copy_files_to_root(src_folder, dest_root)