#!/usr/bin/perl @incoming = ( `ls /home/user/perl/testincoming` ); foreach $directory (@incoming) { chomp($directory); @files = ( `ls /home/user/perl/testincoming/$directory` ); foreach $file (@files) { $pattern = "PGP"; open(FILE,"/home/user/perl/testincoming/$directory/$file") or +die "Could n't open $file"; while (<FILE>) { if (/\Q$pattern\E/) { my $newname=$file; $newname=~s/^./o/; rename ($file, $newname); } close FILE; } } }
In reply to RE: Odd file rename
by Anonymous Monk
in thread Odd file rename
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |