[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: recursively find duplicate filenames

>> On Wed, 5 Jan 2011 03:15:01 -0800 (PST), 
>> S Mathias <smathias1972@yahoo.com> said:

S> find duplicate filenames in a folder recursively? how?

   It's a (pretty ugly) one-liner if you have something to reverse strings
   in a file.  Put this in (say) /usr/local/bin/rev:

     #!/usr/bin/perl -n
     print +(scalar reverse), "\n";

   And then:

     you% cd /some/place
     you% find . -print | rev | cut -f1 -d/ | rev | sort | uniq -c | \
          expand | grep -v ' 1 '

   Or you could replace the uniq-expand-grep with some awk weirdness if
   you're into that.

Karl Vogel                      I don't speak for the USAF or my company

If men ruled the world #18: It would be perfectly legal to steal a sports
car, as long as you returned it the following day with a full tank of gas.

Reply to: