Andrew Fletcher published: 18 December 2019 (updated) 20 December 2019 1 minute read
To copy the content of a directory /source to another existing directory /destination can be achieved with the command cp -a
cp -a source/. destination/
Changing the variables accordingly:
- source = challenge/vendor/
- destination = stg/vendor/
cp -a challenge/vendor/. stg/vendor/
- The -a option is an improved recursive option, that preserve all file attributes and also preserves symlinks;
- The full point (.) at end of the source path (i.e. challenge/vendor/.) is a specific cp syntax that allows you to copy all files and directories (included hidden ones).