After spending time trying to make rsync
work, I decided to use something else. I have a tree of files at /home that I want to backup to a 64G USB stick once a day, using the same tree structure, but only copy over the ones that don't exist in destination ( and preserve timestamps ).
The problem:
Even if a source folder has only one new file (and 400 old ones), my rsync always finds a reason to copy about half of them over to dest.
I experimented with something along the lines of this
find /home/me/a/r/z/ -type f -mmin 400 | xargs -0 -I{} cp '{}' /media/usb-id/$( cut -d / -f 4- {} )
Lots of mistakes, I know. I use "4" with cut because that's where the tree starts in destination (/media/usb-id/r/z/whatever
). I think I should be using sed
somehow in all of this. Any ideas?
Obvious error:
cut: {}: No such file or directory
rsync
works correctly and you should rather ask how to make it work correctly for you instead of asking for an alternative. Rsync is skipping files based on modification time & file size. Maybe have a look on your usb if these somehow changed and why. As an alternative try to use-checksum
switch. This will be slower but in case your mod time on your stick changes whyever this might help. – pLumo May 25 '18 at 13:10rsync
? If you mean the output ofrsync -P
, that’s supposed to show every file IIRC – it has to loop over every file to check for changes, obviously. – dessert May 25 '18 at 13:17-RavC
to be a good formula. – glenn jackman May 25 '18 at 13:19