Date: Fri, 25 Mar 2005 15:17:29 +0200 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Nikolas Britton <freebsd@nbritton.org> Cc: freebsd-newbies@freebsd.org Subject: Re: batch conversion of files to lower case Message-ID: <20050325131729.GA831@gothmog.gr> In-Reply-To: <4243D4C9.4040403@nbritton.org> References: <4243D4C9.4040403@nbritton.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2005-03-25 03:07, Nikolas Britton <freebsd@nbritton.org> wrote: > Posting this here so I can find it next time I need. Converts files in > a directory to lower-case, change "*.TTF" to whatever you want to find > / change: > > find ./ -name "*.TTF" -exec perl -e 'rename($_, lc) || warn "$_: $!\n" > for @ARGV' {} \; In true Perl spirit (TMTOWTDI, etc.) I usually map{} arrays instead of iterating over them with for loops and am a great fan of xargs: find . -name "*.TTF" | \ xargs perl -e 'map{rename($_,lc) || warn "$_: $!\n"} @ARGV' Cool trick though. It has been my favorite way of mass-renaming files for a long time. It's faster to check and harder to get wrong than the equivalent echo/sed/mv stuff in sh(1).
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050325131729.GA831>