All pastes #35253 Raw Edit

Anonymous

public text v1 · immutable
#35253 ·published 2005-12-30 05:25 UTC
rendered paste body
$ cat main.pl                                                                                                   
#!/usr/bin/perl

my %listing;

open(LS, "ls img_*.jpg|");

        foreach $file (<LS>) {

                chomp($file);
                $file =~ /img_(\d{4})\.jpg/;
                my $old_num = $1;
                my $new_num = ($1 + 1300);
                
                $listing{$file} = "img_" . $new_num . ".jpg";

        }

        while (($old, $new) = each(%listing)) {
                        print "$old => $new";
                        print "\n";
                        system("mv ./$old ./$new");
        }


close(LS);