Skip to content

Instantly share code, notes, and snippets.

@churib
Created August 6, 2012 20:45
Show Gist options
  • Save churib/3278264 to your computer and use it in GitHub Desktop.
Save churib/3278264 to your computer and use it in GitHub Desktop.
rename dirs
#!/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