Re: Renaming multiple files
Re: Renaming multiple files
- Subject: Re: Renaming multiple files
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 4 Dec 2008 09:53:36 -0500
On Thu, Dec 4, 2008 at 9:28 AM, Mark J. Reed <email@hidden> wrote:
> ls -1 srcdir | perl -ne 'chomp; rename($_, "destdir/$..xls") or die $! '
Sorry, I just have two small improvements to my own command before I
shut up about Perl and let you get back to your regularly scheduled
AppleScript discussion, already in progress. :)
First, using Fatal.pm makes it easier to get error messages when
something goes awry (and improves their quality over the bare $! I
used above).
Second, I just remembered that the -l option to perl does autochomping
of input as well as auto-newline-appending on output. So it can be
rewritten as below:
ls -1 srcdir | perl -MFatal=rename -lne 'rename ($_, "destdir/$..xls")'
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden