I have two directories which are different versions of the same software package. I'd like to list all the files/directories that have changed between the two then copy those differences to a new directory.
I've been trying different scripts with md5sum
and diff -Nurq
but haven't been able to get the result I'm looking for.
Any recommendations?
Edit:
I originally tried taking md5sum
s, but that didn't seem to work especially if new files were missing.
Next I tried a loop like this:
for x in `diff -Nurq ./dir1/ ./dir2/ | awk -F" " '{print $4}'`
do
mkdir -vp ./dir_1_2_upgrade/$x;
cp $x ./dir_1_2_upgrade/$x
done
But that ended up making a bunch of directories and no files.