Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: list duplicate filenames which only vary by case



On Fri, 26 Sep 2014 09:11:07 +0000 (UTC)
zzapper <david@xxxxxxxxxxxxxx> wrote:
> list files with duplicates in same directory
> e.g.
> house.jpg House.jpg hOUSE.jpg

Assign the contents of the directory to an array and lower-case and sort
it.

local -a array
array=(*)
array=(${(Lo)array})

Now all you need to do is search for consecutive duplicate elements in
the array (exercise for the reader).  If you find one, say element i,

array=((#i)${array[i]})

should collect the ones with the names that match it.

pws



Messages sorted by: Reverse Date, Date, Thread, Author