Linux – How To Copy a Folder [ Command Line Option ]
In Linux, you can use the cp command to copy a folder and its contents to a new location. The basic syntax for copying a folder using cp is as follows:
cp -r source_folder destinationWhere source_folder is the name of the folder you want to copy, and destination is the location where you want to copy the folder.
For example, if you have a folder called example_folder that you want to copy to the directory /tmp, you would run the following command:
cp -r example_folder /tmpThe -r option (or --recursive) tells cp to copy the contents of the source folder and any subdirectories recursively.
Note that if the destination already exists and is a directory, the contents of the source folder will be copied into the destination directory. If the destination does not exist, a new directory with the specified name will be created and the contents of the source folder will be copied into it.
