4

I have 2 folders, and I want to know if folder#1 has all the files in folder#2

How can I check this?

1
  • A little more information please. What OS? Do you want scripting based solutions, or purely third party programs? May 26, 2011 at 22:39

2 Answers 2

7

Giving that folder2 for example has an extra file named test4, but they share all other files in common, you can always use diff.

diff folder1 folder2

In our case that would return:

Only in folder2: test4
1

Assuming you want to find missing files/directories on folder2 from folder1, you do:

ls folder2 > /tmp/f2.txt
ls folder1 | grep -v -f /tmp/f2.txt

That will list all items present in folder1 but not in folder2, you can do the opposite to find both differences.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .