Select Page

Usually we need to compare the content of two directories when we’d like to find the difference of them. For example when we do a penetration test in some web apps to make sure the original file and the modified one. Or we just like to compare two folder of songs 🙂

The solution for this need is using diff command.  diff was included in some Linux OS especially in BackTrack 5 R 3. So we just need to execute it.

Use the command below :

root@bt:~# diff -qr dirX  dirY  | sort > differences.txt

-q –brief  : Output only whether files differ.

-r –recursive :  Recursively compare any subdirectories found.

For example I’d like to compare  the Avenged Sevenfold songs in the two folders. The first folder contents of New album songs of avenged sevenfold. And the second one contents of the new albums and some favourite songs of Avenged Sevenfold.

You’re able to use some options by reading the diff manual using “man diff” command. The other option is like this :

root@bt:~# diff -qr dirXdirY  | grep -v -e ‘DS_Store’ | sort > differences.txt

I wrote this article dedicated to sweetheartofmine acnequin 

Shares
Share This