linuxcp

How do I create a copy of a directory in Unix/Linux?


I want to recursively create a copy of a directory and all its contents (e.g. files and subdirectories).


Solution

  • The option you're looking for is -R.

    cp -R path_to_source path_to_destination/
    
    cp -a path_to_source/. path_to_destination/