Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 5 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.

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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