From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20148 invoked by alias); 26 Sep 2014 09:26:39 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19158 Received: (qmail 6629 invoked from network); 26 Sep 2014 09:26:36 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f4-b7f156d0000063c7-3b-54253149ca21 Date: Fri, 26 Sep 2014 10:26:32 +0100 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: list duplicate filenames which only vary by case Message-id: <20140926102632.71301be4@pwslap01u.europe.root.pri> In-reply-to: References: Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmluLIzCtJLcpLzFFi42I5/e/4ZV1PQ9UQg/lr9Cx2nFzJ6MDoserg B6YAxigum5TUnMyy1CJ9uwSujHvfXzEXzGKpmPz7J3MD4xrmLkYODgkBE4mpm326GDmBTDGJ C/fWs3UxcnEICSxllNi8+gc7lMMk8f/6RmaQKhYBVYmFM7exg9hsAoYSUzfNZgSxRQREJZav 2MwOMlRYwFZiwi1+kDCvgL1E35sfLCA2J1D49YpJTCC2kICNxMrznWAj+QX0Ja7+/cQEcYS9 xMwrZxghegUlfky+B9bLLKAlsXlbEyuELS+xec1b5gmMArOQlM1CUjYLSdkCRuZVjKKppckF xUnpuYZ6xYm5xaV56XrJ+bmbGCEB+GUH4+JjVocYBTgYlXh4b6xTCRFiTSwrrsw9xCjBwawk wmukoBoixJuSWFmVWpQfX1Sak1p8iJGJg1OqgXFalMmOuTe8tG8yvrxU0598n0Pgjmt+mftF kSlhito/VcTSP6QG2pWdmq1+Oeyt0Ap71t7Qjsrc9Ts7Vmw/+Lxb7pjJqti3k+bfFOCcvVGN c0mu3JfONeU73TWMuc5Fyj3dm3uh4me4MOf/eJ35NXwVp/568DhJxGxgMDFx0xcsMJBT5vZ6 rMRSnJFoqMVcVJwIAPLYTq0eAgAA On Fri, 26 Sep 2014 09:11:07 +0000 (UTC) zzapper 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