6
Windows has a nice option to its XCOPY command: /D. This copies only files where the source modification time is newer than the destination time. Is there any unix/linux equivalent of this? I'm trying to get a fast copy to my local testing server.
6
Windows has a nice option to its XCOPY command: /D. This copies only files where the source modification time is newer than the destination time. Is there any unix/linux equivalent of this? I'm trying to get a fast copy to my local testing server.
10
I usually do:
rsync -avz /from/where/ /to/dest/
If you want it to delete files that doesn't exist anymore in /from/where add --delete.
It can also be used from different boxes like this:
rsync -avz eromero@mydevbox.org:/from/where/ eromero@mybox.org:/to/dest/
Normally I'd add "-e ssh" to that last one. I don't like running an rsync server because it's not secure enough. – Paul Tomblin – 2009-11-05T21:40:35.703
1I was under the impressions that rsync uses ssh by default. I think you need two colons to specify an rsync server. – Ryan C. Thompson – 2009-11-05T22:39:40.873
Oh yeah, you might want to throw in the --update option, if you don't want to overwrite newer files in the destination, but only older ones. It depends on whether you just want to efficientlysynchronize the two directories, or you want the exact behavior described above, with modification times. – Ryan C. Thompson – 2009-11-05T22:51:33.953
1Yeah, it uses ssh by default. Need to add more "options" for rsync. Funny huh? – Eduardo Romero – 2009-11-05T23:14:35.700
10
cp --update src dest
From the man page:
copy only when the SOURCE file is newer than the destination file or when the destination file is missing
3
My brain couldn't quite cope with the complexities of rsync so I installed Lucky Backup. This provides an easy to use graphical interface as a front end for rsync. When you've set up your copy/backup task, you can run it from the programme. You can also click on the "validate" button for the task and it will give you the full rsync command line such that you can run it in a terminal or paste it into a shell script. It's a nice tool for teaching the use of rsync.
Clicking on the "Advanced" button in the "Task Properties" window gives access to some of rsync's features.
1Can you expand upon your answer with some screenshots? Your answer reads a bit like spam. – bwDraco – 2015-04-07T16:31:17.620
I tried to add a screenshot but the system demanded I had at least 10 reputations! I have added a link instead. – Gannet – 2015-04-11T20:06:08.397
This should be asked on SuperUser as it has nothing to do with programming. – SLaks – 2009-11-05T21:34:12.303