You've got three folders:
- folder current, which contains your current files
- folder old, which contains an older version of the same files
- folder difference, which is just an empty folder
How do you compare old with current and copy the files which are different (or entirely new) in current to difference?
I have searched all around and it seems like a simple thing to tackle, but I can't get it to work in my particular example. Most sources suggested the use of rsync so I ended up with the following command:
rsync -ac --compare-dest=../old/ new/ difference/
What this does however, is copies all the files from new to difference, even those which are the same as in old.
In case it helps (maybe the command is fine and the fault lies elsewhere), this is how I tested this:
- I made the three folders.
- I made several text files with different contents in old.
- I copied the files from old to new.
- I changed the contents of some of the files in new and added a few additional files.
- I ran the above command and checked the results in difference.
I have been looking for a solution for the past couple of days and I'd really appreciate some help. It doesn't necessarily have to be using rsync, but I'd like to know what I'm doing wrong if possible.