Copy folder to new destination linux

A simple but essential task!

To copy a folder to a new destination in Linux, you can use the cp command. Here are a few ways to do it:

Method 1: Copy folder recursively

cp -r /source/folder /destination/folder

This will copy the entire folder and all its contents to the new destination.

Method 2: Copy folder with overwrite

cp -r /source/folder /destination/folder

This will overwrite any existing files in the destination folder.

Method 3: Copy folder with preserve permissions and timestamps

cp -r -p /source/folder /destination/folder

This will preserve the permissions and timestamps of the files and folders being copied.

Method 4: Copy folder with verbose output

cp -r -v /source/folder /destination/folder

This will display a verbose output of the copying process.

Method 5: Copy folder using rsync

rsync -avz /source/folder /destination/folder

This will copy the folder and its contents, preserving permissions, timestamps, and other attributes. The -a option preserves permissions, -v option displays verbose output, and -z option compresses the data during transfer.

Make sure to replace /source/folder with the path to the folder you want to copy, and /destination/folder with the path to the new destination folder.