Copy Entire Directory in Linux

June 28th, 2007

One of the most perplexing things when learning command line for Linux is copying an entire directory, contents (files and sub-directories) included. Sure it’s easy to copy individual files, or all files of a certain type but what about that all at once convenience Windows and Mac have us accustomed to? The trick is the -r flag, which tells copy to work recursively through the directory tree.

Example : cp -r dirtocopy/ newdir/