Paul wrote:
OK, was kinda rust, been working on Solaris servers for year, but not been
working solely with windows, but I sure do miss scripting, no matter how
screwed up my programming skills are, it's fun! Here is what I have with
"\" replacing "/" and better fixes with counting. Yes, I know there is a
better way, but my brain isn't advanced enough yet, although I want to be
there some day:
#user/bin/perl -w
use File::Find;
my @all_file_names;
my $x = 1;
my $file1 = 'C:/Users/MeHere/test1/thefile1.txt';
my $file2 = 'C:/Users/MeHere/test1/thefile2.txt';
find sub {
return if -d;
push @all_file_names, $File::Find::name;
}, 'C:/Users/MeHere/Downloads/Pics/Temp';
open FILE1, ">$file1" or die $!;
open FILE2, ">$file2" or die $!;
for my $path ( @all_file_names ) {
if ($x < 11) {
print FILE1 "echo PART 1a\n" if $x == 1;
print FILE1"pause\n" if $x == 1;
$path =~ tr/\//\\/d;
The /d option stands for Delete, which means that anything in the
left-hand list that is not in the right-hand list will be deleted
instead of transliterated (replaced) but the left-hand list and the
right-hand list are the same size so there is nothing to delete so the
/d option is superfluous.
$path =~ tr!/!\\!;
print FILE1 "nfixup $path -f\n" if $path =~ /\.JPG/;
If you are only looking for the string '.JPG' at the *END* of the path
name (a file extention) then you should anchor the pattern at the end.
print FILE1 "nfixup $path -f\n" if $path =~ /\.JPG\z/;
print FILE1 "Done with PART 1a\n" if $x == 10;
print FILE1 "pause\n" if $x == 10;
print "$x\n";
}
John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity. -- Damian Conway
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/