Created
August 6, 2012 20:45
-
-
Save churib/3278264 to your computer and use it in GitHub Desktop.
rename dirs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use warnings; | |
use strict; | |
run() if !caller; | |
sub run { | |
chdir '/home/timo/Pictures/Fiene/'; | |
my @files = <*>; | |
for ( @files ) { | |
next if !-d $_; | |
next if $_ !~ /(\d{2})\.(\d{2})\.(\d{4})/; | |
my $new = "$3.$2.$1"; | |
rename $_, $new or die "Cannot rename $_\n"; | |
print "renamed '$_' => '$new'\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment