Advertisement
kwasinski

SpecificRename

Apr 29th, 2016
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.28 KB | None | 0 0
  1. #!perl
  2.  
  3. @{$_} =  grep {!m/^\.+?/} readdir dir if opendir dir, '.';
  4. foreach (@{$_}) {
  5.     next  if -d;
  6.     m/\-(\d+)(\.\w{3,3})$/;
  7.     my ($l, $replace, $ext, $newFileName) = (length $1, $1, $2, '0000');
  8.     $newFileName =~ s/\d{$l}$/$replace/e;
  9.     `mv $_ $newFileName$ext`;
  10. }
  11.  
  12. __END__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement