Skip to content

A nice shell command to diff two folders

January 29, 2009

[lang_en]

Today, while working, I had to take “diff” of each folder and found the following command. Works perfectly on macOSx shell, should work in linux shell too.

diff -qr dirA dirB | grep -v -e ‘DS_Store’ -e ‘Thumbs’ | sort

here, DS_Store and Thumbs are two folders you want to exclude. The output looks like:

Files ./dirA/File1 and ./dirB/File1 differ
Files ./dirA/File2 and ./dirB/File2 differ

[/lang_en]

[lang_tr]

Bugün çalışırken 2 farklı klasorun farkını almam gerekti ve aşağıdaki scripti buldum. MacOSx  kabuğunda düzgün çalışıyor, linuxta da çalışmalı.

diff -qr dirA dirB | grep -v -e ‘DS_Store’ -e ‘Thumbs’ | sort

burada DS_Store ve Thumbs karşılaştırmaya katmak istemediğimiz 2 dosya. Şöyle bir çıktı alıcaksınız:

Files ./dirA/File1 and ./dirB/File1 differ
Files ./dirA/File2 and ./dirB/File2 differ

[/lang_tr]

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.