Duplicating a directory tree with rsync
I'm currently duplicating a directory tree with hard links with this command:
Code:
cp -aluv /path/to/sourcedir/* /path/to/destdir/ |
Ok, I feel a bit daft now as I may well have sussed it:
Code:
find /path/to/sourcedir/ -mindepth 1 -exec cp -aluv {} /path/to/destdir/ \; edit: ok, just tried that out, it doesn't work (and should have been obvious). Obviously it just copies all files it finds to the the root of destdir - doh. Just noticed the --parents flag, but that creates the entire directory path in destdir (so /path/to/destdir/path/to/sourcedir/) further edit: right, so to wrap this up, I realised this was partially due to my stupidity. By changing to the sourcedir and then specifying the correct mindepth (2), I ended up with a working solution: Code:
cd /path/to/sourcedir && find . -mindepth 2 -exec cp -aluv --parents {} /path/to/destdir/ \; |
All times are GMT -5. The time now is 08:11 PM. |