Episode 57 URLs & Notes (MP3) (AAC)
- Lone Star Brewing Company
- Powered subwoofers
- Two other follow-ups
- Voicemail from Ralph
- Apple & ZFS
- Voicemail from Ralph
- Cool, Free Cell Phone Services
- Zune
- Woot
- Apple WWDC 2007
Episode 57 URLs & Notes (MP3) (AAC)
Here’s the ‘rename.pl’ script I mentioned in Ep. #56, originally written my Tom Christiansen and Nathan Torkington in “The Perl Cookbook” (Chapter 9.9, Renaming Files, O’Reilly, 1999)
#!/usr/local/bin/perl# Usage: rename perlexpr [files]
($op = shift) || die “Usage: rename perlexpr [filenames]\n”;
if (!@ARGV) {
@ARGV = ;
chop(@ARGV);
}
for (@ARGV) {
$was = $_;
eval $op;
next if (-e $_);
die $@ if $@;
rename($was,$_) unless $was eq $_;
}
Note: I added the 3rd line in the for loop, “next if (-e $_);” to prevent clobbering already existing files.
Some common cases where I use this:
Change spaces to underscores:
Change JPEG to jpg:
Zero pad numbers in filenames (ie. ‘blah_1.jpg’ to ‘blah_01.jpg’):
Clean up pesky downloads:
Clean up filenames:
Episode 56 URLs & Notes (MP3) (AAC)
23 queries. 0.042 seconds.