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'm trying to create a "changed files" package from one directory to another and need to find a Linux/Unix tool/utility that will be able to handle this.


  • Package_1.1/ (old)
  • Package_1.2/ (new)
  • changed_files/ (only changed and new files and directories)

changed_files would be a directory containing a recursive structure of only files that have been added or changed in Package_1.2 compared to Package_1.1)

Update: I tried using:

cd Package_1.2
rsync -a -c --compare-dest=../Package_1.1 . ../changed_files/
find -depth ../changed_files -type d -empty -delete

However there were some files that had a slightly different modified time that were copied over, yet the contents were identical. (md5 produced an identical checksum on each file). So while I think I'm close using this command, I'm still missing something.

share|improve this question
To be clear, you want to copy files from Package_1.2 that are different from those in Package_1.1 into a new directory maintaining the same directory structure? – Thor Jul 27 '12 at 19:38
@Thor, that is correct. – Highway of Life Jul 27 '12 at 19:44

When using rsync, It seems that the -c (--checksum) option does not override the -t (--times) option within -a (--archive), which uses -rlptgoD, and thus it will still look at file modification times.

One possible solution is to use: -rlpgoDc rather than -a. The command would look like this:

cd Package_1.2
rsync -rlpgoDc --compare-dest=../Package_1.1 . ../changed_files/
find -depth ../changed_files -type d -empty -delete

This may not be the most elegant solution, perhaps someone has a better idea of how rsync can do the whole job by itself.

share|improve this answer

You must log in to answer this question.

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