Re: batch conversion of files to lower case
From: Giorgos Keramidas (keramida_at_ceid.upatras.gr)
Date: 03/25/05
- Previous message: Nikolas Britton: "batch conversion of files to lower case"
- In reply to: Nikolas Britton: "batch conversion of files to lower case"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 25 Mar 2005 15:17:29 +0200 To: Nikolas Britton <freebsd@nbritton.org>
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).
_______________________________________________
freebsd-newbies@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-newbies
To unsubscribe, send any mail to "freebsd-newbies-unsubscribe@freebsd.org"
- Previous message: Nikolas Britton: "batch conversion of files to lower case"
- In reply to: Nikolas Britton: "batch conversion of files to lower case"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]