I have two identical folders with subfolders for development and live like:



And I want to rsync all recent work done after a specific from development folder to live folder.

To do this, I am using

find development/ -type f -newermt '2/2/2020 0:00:00' -exec rsync -avz {} live/ \;

But what's happening is that all files from development are being copied to live folder's root even the files are in subfolders of development folder. But what I want is rsync to sync files in their exact subfolders on destination.

So, basically what I want is to perform 'rsync -avz' to update files after a specific date.

I have tried multiple solutions also to find solution, but could not. Tried with --files-from. Any thought on this?

  • Do you need a date cutoff? If you copied all files why would that be a problem? (Are there files that must not be copied, or do they get updated in the live system, or...?)
    – roaima
    Feb 12, 2020 at 10:31
  • 1
    Because there are alot of files in development folder which are not required and are there for testing only and they I do not want to copy.
    – Hashmi
    Feb 12, 2020 at 10:55

1 Answer 1


You can feed the set of files to be copied into a single instance of rsync. The missing part of the puzzle is to retain the source path in the destination:

find development/./ -type f -newermt '2/2/2020' |
    rsync --dry-run -vtpR --files-from - . live/

The . in the source path for find marks the point from which the path is to be retained in the destination. I've omitted your -z flag because compression is not performed when copying locally. Remove the --dry-run when you're happy it's going to do what you hope it will.

Note that rsync is not really doing anything clever here. You could equally use tar (or pax):

tar cf - -C development --newer-mtime='2020-02-02' . | tar xvf - -C live

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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