Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use File::Find;
- sub eachFile {
- my $filename = $_;
- my $fullpath = $File::Find::name;
- #remember that File::Find changes your CWD,
- #so you can call open with just $_
- if (-d "$filename") {
- my @files;
- my @f;
- my $filename;
- my $a;
- my $i;
- my $start;
- my $end;
- chomp $filename;
- next if ($filename =~ /^(\.|\.\.)$/);
- next if $filename eq "";
- opendir(IN,"$filename/");
- @f = readdir(IN);
- foreach $a (@f) {
- if ($a =~ /^(.+)\.html$/) { $i =$1; push(@files, $i); }
- }
- closedir(IN);
- $start = $files[0];
- $end = $files[-1];
- print "$filename: START: $start END: $end\n";
- rename("$filename","$start-$end");
- }
- }
- find (\&eachFile, ".");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement