OK, it was late at night, and working 7 days/week doesn't help. Anyhow,
after looking at my convoluted script, I have one that works now, but am
now trying to figure out an easy way to change the "/" in the resultant
file to "\" to work in windows. Always something.
#user/bin/perl -w
use File::Find;
my @all_file_names;
my $x = 0;
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 < 10) {
$x = $x+1;
print FILE1 "echo PART 1a\n" if $x == 1;
print FILE1"pause\n" if $x == 1;
print FILE1 "nfixup $path -f\n" if $path =~ /\.JPG/;
print FILE1 "Done with PART 1a\n" if $x == 10;
print FILE1 "pause\n" if $x == 10;
print "$x\n";
}
if ($x > 9 && $x < 20) {
$x = $x+1;
print FILE2 "echo PART 1b\n" if $x == 11;
print FILE2 "pause\n" if $x == 11;
print FILE2 "nfixup $path -f\n" if $path =~ /\.JPG/;
print FILE2 "Done with PART 1b\n" if $x == 20;
print FILE2 "pause\n" if $x == 20;
print "$x\n";
}
}
close FILE1;
close FILE2;
On Thu, April 29, 2010 2:19 pm, Paul wrote:
> Hey all. I'm trying to make a perl script create some bat scripts to run
> some specific command and run a few at a time. If that makes any sense.
> Anyhow, say there are 20 files in a dir. Now these files change at times,
> so to make it easier I'm making a perl script to make the bat scripts to
> run these specific commands on each file, reason is, so I can run a few at
> a time to save time. Now there are man more than this, but I'm making it
> simple just so I can expand on this later. Here is my convoluted script
> right now, I'm just using jpg's just as an example, but here it is:
>
> The first result of 10 commands on 10 files works fine, but the second one
> is empty. Any pointers in the right direction? Thanks.:
> -------------
> use File::Find;
>
> my @all_file_names;
>
> my $x = 0;
>
> my $file1 = 'C:/Users/MeHere/test1/thefile1.txt';
>
> find sub {
> return if -d;
> push @all_file_names, $File::Find::name;
> }, 'C:/Users/MeHere/Downloads/Pics/Temp';
>
> open FILE, ">$file1" or die $!;
>
> for my $path ( @all_file_names ) {
>
> while ($x < 10) {
> $x = $x+1;
> print FILE "echo PART 1a\n" if $x == 1;
> print FILE "pause\n" if $x == 1;
> #$path = (s/\//\\/g); (also trying to replace / with \ for windows)
> print FILE "do this command $path -d -S 10\n" if $path =~ /\.JPG/;
> print FILE "Done with PART 1a\n" if $x == 10;
> print FILE "pause\n" if $x == 10;
> print "$x\n";
> }
>
> close FILE;
> my $file2 = 'C:/Users/MeHere/test1/thefile2.txt';
> open FILE, ">$file2" or die $!;
>
> while ($x < 20) {
> $x = $x+1;
> print FILE "echo PART 1b\n" if $x == 11;
> print FILE "pause\n" if $x == 11;
> print FILE "do this command $path -d -S 10\n" if $path =~ /\.JPG/;
> print FILE "Done with PART 1b\n" if $x == 20;
> print FILE "pause\n" if $x == 20;
> print "$x\n";
> }
>
> }
>
> close FILE;
> ------------------------------
>
>
> --
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> http://learn.perl.org/
>
>
>
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/