I currently have a crontab job running on my machine every friday at 3 AM as a back up method. The job runs a bash script which runs an rsync command to sync files from the server to my external hard drive. The rsync command uses the --include-from flag to get a list of files to rsync such as *.cpp *.h etc.

Unfortunately I'm running out of space on my hard drive and I want to replace it with another drive with the same storage room on it. If I just continue the rsync as it is, I would not have gained anything because the second drive will be identical to the first, and it'll be full.

I would ideally like to rsync only files from --include-from AND newer than the date at which I replaced my external drives (e.g., say I replace my drive today, then I want to rsync the files in my included file list AND newer than 3/27/2015). That way it'll just be a continuation of the first drive.

Everything I can find online uses the find method to first get a list of files newer than date, and then pipe that list to rsync. But since this is all happening from my local machine, how can I use find from my local machine to get the file list on the server? Is there a better option, perhaps an rsync flag which checks the file's last-modified date?



2 Answers 2


After your last backup using the old disk, create a timestamp and then backup files after that timestamp. You'll use find and the --newer flag to list files newer than the timestamp, then the --file-from flag to rsync to specify that list of files for copying.

Here's how:

Step 1: Before you swap to the new drive: touch /someplace/timestamp.txt

Step 2: Change to the new disk.

Step 3: Modify the cronjob script to do something like:

find BLAH BLAH BLAH -newer /someplace/timestamp.txt -type f -print0 >/tmp/list rsync -avP --inplace --file-from=/tmp/list --from0 desthost:/dest/place

NEVER change, touch, or modify the /someplace/timestamp.txt file.


presumably you have ssh access to the server? so

  1. either: grant the server ssh access to your local machine and then use something like ssh you@server 'find ... | xargs -0 -I {} rsync "{}" you@yourmachine:/media/dir'
  2. or: create a list of files on the server using find, then copy this file to your local machine and run rsync from there to grab these files

I have to say I don't like this though. For full file recovery you will still need both of your backup disks, the old one and the new, and the recovery might be complex. I can think of several ways of improving this strategy, but the easiest in your case would be to get a new but bigger disk instead of a new one that is the same size. Surely the extra cost is not that significant?

You must log in to answer this question.

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