< BACK

Bash tips, tricks and code snippets

Copy a whole directory preserving permissions

This is my favourite bash one-liner of all time:

(cd /source/dir && tar cpf - . ) | (cd /target/directory && tar xpf -)