flieckster has asked for the wisdom of the Perl Monks concerning the following question:
Hi there, i have a series of files with the word "white" in them that needs to be updated to "main". i got it to sort the files to move the "_white" but can't get it to rename. 76035265_001_white.tif 76035265_102_white.tif 76035266_001_white.tif
my $mybadmatch="_white.tif"; chdir( $tiff ) or mail ($to = $dllist, $from = $dllist, $subject= "can + not move $file", $body ="can not move $file" ); (@tiff_list) = glob "*tif"; my $upload_count = @tiff_list; foreach my $file (@tiff_list) { if ($file =~ m/$mybadmatch/is) { print "$file is white background match\n"; my $old = "$tiff$file"; my $new = "$whitefiles"; copy ($old, $new) or mail ($to = $dllist, $from = $dllist, $subject= " +can not move $file", $body ="can not move $file" ); open FILE, '>> /Users/flieckb/Desktop/whitefiles.txt' or warn $!; print FILE "$date\t$file\t"; print FILE "\n"; } else { print "$file :normal production image\n"; } } close FILE; chdir( $whitefiles ) or mail ($to = $dllist, $from = $dllist, $subject += "can not get to $whitefiles", $body ="can not get to $whitefiles") +; (@white_list) = glob "*tif"; foreach $file (@white_list) { my $oldfile = $file; # s/.* //g; rename($oldfile, $file); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: rename files
by Laurent_R (Canon) on Feb 02, 2018 at 20:11 UTC | |
by flieckster (Scribe) on Feb 02, 2018 at 20:16 UTC | |
by poj (Abbot) on Feb 02, 2018 at 20:38 UTC | |
|
Re: rename files
by mandarin (Hermit) on Feb 05, 2018 at 16:51 UTC |