Use shutil.copy(src, dest) to copy a file to a destination while preserving the content but not metadata like permissions.
shutil.copy2(src, dest) copies the file and its metadata, including timestamps and permissions, for more precise duplication.
To copy just the permissions, use shutil.copymode(src, dest) without altering content or other metadata.
Use shutil.copyfile(src, dest) for copying only file data without metadata or permissions, ideal for creating fresh copies.
For copying entire directories, use shutil.copytree(src, dest) to duplicate a directory and all its subdirectories.
Wrap shutil operations in a try-except block to handle errors, such as missing files or permission issues, gracefully.