Skip to content

Instantly share code, notes, and snippets.

@sinkovsky
Created June 13, 2010 19:04
Show Gist options
  • Save sinkovsky/436899 to your computer and use it in GitHub Desktop.
Save sinkovsky/436899 to your computer and use it in GitHub Desktop.
use File::Find;
use File::Copy;
use Cwd;
my $workdir = getcwd;
find(sub {
return if -d;
return if -l;
return if /^\./;
print $_,"\n";
if ( my ($name) = $_ =~ /([^\-]+)-\w{4}.wav/ ) {
my $old = $workdir."/".$File::Find::name;
my $new = $workdir."/".$File::Find::dir."/".$name.".wav";
print "Renaming ", $old, "-> ", $new,"\n";
move $old, $new or die "Can't rename, $!";
}
}, "foobar");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment