I have a set of files in storage, and I would like to get only the new files and put it in another directory. Is there a way to do this?

For example:

The "old files" are contained in: folder/oldfiles

I would like the new files coming in from rsync to be put in folder/ [and my script would put it in oldfiles, after the file has been processed]

Is there anyway to do this with rsync?

link|improve this question

feedback

1 Answer

up vote 1 down vote accepted
  1. Use rsync --ignore-existing --dry-run --verbose SOURCE PROCESSED > OUTPUTFILE
  2. Process OUTPUTFILE to make sure it only contains file names
  3. Use rsync --files-from=OUTPUTFILE SOURCE PROCESSING
  4. Process each file in PROCESSING and move it to PROCESSED

Of course, you will want to add your usual options to the first rsync comand, e.g. --archive or --recursive.

link|improve this answer
1. Requires the -v option. – monksy Feb 21 '11 at 1:28
3. the source is required – monksy Feb 21 '11 at 1:40
1  
@steven Yes indeed. Thanks. Fixed. – Mikel Feb 21 '11 at 4:19
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.