Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 6 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
@steven Yes indeed. Thanks. Fixed. – Mikel Feb 21 '11 at 4:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .