I want to recursively create a copy of a directory and all its contents (e.g. files and subdirectories).
The option you're looking for is -R
.
cp -R path_to_source path_to_destination/
destination
doesn't exist, it will be created.-R
means copy directories recursively
. You can also use -r
since it's case-insensitive.-a
flag along with trailing /.
in the source (as per @muni764
's / @Anton Krug
's comment):cp -a path_to_source/. path_to_destination/