Copy Directory with Sub Directories in Linux

You can use the ‘cp’ command in Linux to copy a directory with all it’s files and accompanying sub directories with the following option:

cp -r directoryname newdirectory

Make sure that you do not tab through so as to create the backslash (I don’t know why that it, but it won’t work otherwise).

That’s it. Using the option ‘r’ will make a copy for you of any directory with all subdirectories and its contents intact.

Post written by Ed Reckers

Founder and lead web development consultant at Red Bridge Internet : San Francisco WordPress Developers and Consultants.

Leave a Reply