Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy in bash all directory and files recursive?

People also ask

How do I copy an entire directory in bash?

Copy a Directory and Its Contents ( cp -r ) Similarly, you can copy an entire directory to another directory using cp -r followed by the directory name that you want to copy and the name of the directory to where you want to copy the directory (e.g. cp -r directory-name-1 directory-name-2 ).

How do I copy a directory in Linux recursively?

Use the -r Flag to Copy Files Recursively in Linux The -r or -R flag allows you to copy directories and their contents recursively. Type the directory name you want to copy after the cp -r command and the destination directory. We can also use the -a flag.

How copy all files and subdirectories in Linux?

Copying Directories with cp Command To copy a directory, including all its files and subdirectories, use the -R or -r option. The command above creates the destination directory and recursively copy all files and subdirectories from the source to the destination directory.

What is the command to copy files recursively?

To copy a single file or multiple files recursively with the Windows command prompt, use the xcopy command.


cp -r ./SourceFolder ./DestFolder

code for a simple copy.

cp -r ./SourceFolder ./DestFolder

code for a copy with success result

cp -rv ./SourceFolder ./DestFolder

code for Forcefully if source contains any readonly file it will also copy

cp -rf ./SourceFolder ./DestFolder

for details help

cp --help

You might find it handy to keep your attributes set

cp -arf ./SourceFolder ./DestFolder