How can I compare two folder content under linux.
I'm using diff
but I want to display only the files with the same names.
Asked
Active
Viewed 4,210 times
3 Answers
1
#!/bin/bash
ls $1 >/tmp/$$1
ls $2 >/tmp/$$2
join /tmp/$$1 /tmp/$$2
rm /tmp/$$1
rm /tmp/$$2

symcbean
- 21,009
- 1
- 31
- 52
0
#!/bin/bash
D1=/tmp/1
D2=/tmp/2
f1=$(find "$D1" -type f)
f2=$(find "$D2" -type f)
for i in $f1; do
echo $f2 | grep $(basename $i) >/dev/null && echo $i
done

initall
- 2,325
- 3
- 18
- 19