30 lines
No EOL
926 B
Python
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) |