There’s lots of solutions for creating a file level patch for text files and the like. What I’m looking for is an easy script/shell command that will compare oldversion/ newversion/ and give me a tree of files that I need to copy over oldversion to make it be equal to newversion (assuming files are not removed in the updated version). Note that the two folders contain both binary and text files.
Previously, we were using the hack:
fdupes -qrf newversion/ oldversion/ | grep "newversion" | xargs rm;
Leaving us with the folder “newversion” that could be packaged as a patch.
Unfortunately, this turned out to be disastrous because fdupes does not consider filenames.
What’d be great is something like fdupes that actually did include the filename in the comparison.
The diff command can be asked to output filenames which differ.
Of course, it’s not a nice output, but since you’re only looking for NEW files to package as a patch, a quick sed pipe works wonders:
(broken for readability)
Spaces around ‘and’ and preceeding ‘differ’
The ORDER of the operands to diff makes a difference, first argument is left of ‘ and ‘, second is after. Watch out for that.
Also, if you delete a file from NEWDIR, this will not find it as given, only added or changed files. To also output filenames for files not found in either subdir, replace the –unidirection-new-file with –new-file. (short options exist for all except –unidirectional..)