Created
December 24, 2011 10:49
-
-
Save kazu634/1517110 to your computer and use it in GitHub Desktop.
This file contains 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 | |
# for formality's sake | |
use strict; | |
use warnings; | |
# reading directories | |
opendir(DIR,'.') or die "$!"; | |
my $index = 0; | |
foreach (readdir(DIR)){ | |
# do something if $_ is directory | |
if ((-d $_) && ($_ =~ /^[^\.]/)) { | |
$index++; | |
printf("mv %s tmpdir%03d\n", $_, $index); | |
printf("#mv tmpdir%03d %s\n", $index, $_); | |
}; | |
} | |
# closing | |
closedir (DIR); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment