def chromacopy(source_dir, destination_dir):
if not os.path.exists(source_dir):
print(f"The source directory '{source_dir}' does not exist.")
else:
if os.path.exists(destination_dir):
for root, dirs, files in os.walk(destination_dir):
for file in files:
os.remove(os.path.join(root, file))
for dir in dirs:
shutil.rmtree(os.path.join(root, dir))
print(f"Cleared contents of directory '{destination_dir}'.")
try:
shutil.copytree(source_dir, destination_dir, dirs_exist_ok=True)
print(f"Directory '{source_dir}' has been copied to '{destination_dir}'.")
except Exception as e:
print(f"An error occurred while copying the directory: {e}")