Command find duplicate filename on folder
May-20-2015 By admin
TAG : Command find duplicate filename on folder
example :
folder /root/test2/ ?:
cd /root/test2/
ls -al
-rw-r–r– ?1 root root ? ?0 Nov 15 14:42 111
-rw-r–r– ?1 root root ? ?0 Nov 15 14:42 222
-rw-r–r– ?1 root root ? ?0 Nov 15 14:42 333
-rw-r–r– ?1 root root ? ?0 Nov 15 14:43 444
-rw-r–r– ?1 root root ? ?0 Nov 15 14:43 555
-rw-r–r– ?1 root root ? ?0 Nov 15 14:43 666
drwxr-xr-x ?2 root root 4096 Nov 15 14:43 test ? –> folder test
ls -al test/
-rw-r–r– 1 root root ? ?0 Nov 15 14:42 111
-rw-r–r– 1 root root ? ?0 Nov 15 14:43 555
-rw-r–r– 1 root root ? ?0 Nov 15 14:43 666
cd /root/test2/
find . -print | rev | cut -f1 -d/ | rev | sort | uniq -c | ?expand | grep -v ‘ 1 ‘
2 111 –> find duplicate file name 111 on /root/test2/ 2 filename 111
2 555 –> find duplicate file name 555 on /root/test2/ 2 filename 555
2 666 –> find duplicate file name 666 on /root/test2/ 2 filename 666
Posted in: Linux Commandline.