Reputation: 133
I'm able to find all identical files in 2 directories with the following command:
diff -srq sub1/ sub2/ | grep identical
Is it possible to delete founds one easily, so I only have the not identical files in both directories?
Upvotes: 0
Views: 65
Reputation: 28434
This is off-topic on this site, but I'll answer. Since your question is somewhat unclear to me, whether you want to delete all identical files, or only one of the files, so I'll give you both options.
This deletes all matched files:
diff -srq sub1/ sub2/ | grep identical | xargs rm
This deletes only first matched file:
diff -srq sub1/ sub2/ | grep identical | head -1 | xargs rm
Note, I haven't tested this, but at least you have a starting point.
Upvotes: 1