Skip to content

Instantly share code, notes, and snippets.

@mniip
Created October 6, 2014 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mniip/15b94339a7b5098249d3 to your computer and use it in GitHub Desktop.
Save mniip/15b94339a7b5098249d3 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use File::Temp qw(tempfile);
opendir(D, ".");
@files = sort readdir(D);;
closedir(D);
($fh, $fn) = tempfile();
for $d(@files)
{
print $fh "$d\n";
}
system("vim", $fn);
open $f, $fn;
while($n = <$f>)
{
chop $n;
$o = shift @files;
print "'$o' => '$n'\n";
rename $o, $n;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment