2

I'm trying to replace my cp function by an rsync function My cp function is the following

find /home/odroid/USBHD/Movies/ -iname "*.mkv" -mtime '-1' -exec cp -n {} /home/odroid/NASVD/Movies \;

do you guys have any idea how to do this(note the mtime can also be replaced by --ignore-existing

  • Please refer to the answer here on how to use rsync with find. – Ramesh Sep 27 '14 at 18:24
  • Well.. Unfortunately I can not seem to get that to work. – Jorrick Sleijster Sep 27 '14 at 20:16
  • What are you trying to do exactly? Do you want to replace cp -n by rsync with the right options, or do you want to replace the whole command line? When you say “the mtime can also be replaced by --ignore-existing”, do you mean that copying all files but ignoring already-existing files would be ok, in which case, why isn't rsync -a --ignore-existing /home/odroid/USBHD/Movies/ /home/odroid/NASVD/Movies/ ok? – Gilles 'SO- stop being evil' Sep 27 '14 at 23:36

1 Answers1

2
find /home/odroid/USBHD/Movies/ -iname "*.mkv" -mtime '-1' -print0 | xargs -0 -I{} rsync -a --ignore-existing {} /home/odroid/NASVD/Movies/
GMaster
  • 6,322