Copy directory trees while preserving timestamps and mode when possible.
Section: Copy, Move, Rename
Copy directory recursively with preserved metadata
bash
bash
cp -a source-dir target-dirLearn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Copy, Move, Rename
Install file with mode
Copy a file and set destination permissions in one step.
Create nested directories
Create a directory path including missing parents.