Linux difference between two directories

April 15, 2015

This command will find the different files between two directories in linux:

 

diff --brief -r folder1 folder2 > /tmp/difference.txt

 

You can then view all the files which are missing from one folder by doing a grep on the difference file e.g.

 

grep -irsn "Only in folder2" /tmp/difference.txt > /tmp/only-in-folder2.txt

Share on Facebook
Share on Twitter
Please reload

Recent Posts