my @fileNames = (".","..",1,2,3,4,5,6,7,8,9); #assuming that's what the
readdir gives.
splice (@fileNames,0,2); #removes the . and ..
foreach(@fileNames){
if (!-e $_){
print "Sending missing for file: $_";
sendMissing($_); pause();
}
}
I'm not sure we can use the !-e (-e test existe
On Friday 16 November 2001 01:36 pm, Etienne Marcotte rambled:
> > for(my $i = 2, my $j = 1; $i <= $last;$i++, $j++) {
> > if ($j ne $fileNames[$i]) {
> > print "Sending missing for file: $fileNames[$i]";
> > &sendMissing($j);
> > &pause;
> > next;
> > }
>
> for(my $i = 2, my $j = 1; $i <= $last;$i++, $j++) {
> if ($j ne $fileNames[$i]) {
> print "Sending missing for file: $fileNames[$i]";
> &sendMissing($j);
> &pause;
> next;
> }
You never close the opening bracket in the if statement.
and your for is not
I've rewritten the algorithm, but it still is not working correctly. Files 1,
2, 3, 4, 5 are all present, 6 and 7 are missing and 8 is present.
When it gets to the first missing file (6) it skips right over 6 and 7
without running the code in the if statement, but then runs the if statement
co
> -Original Message-
> From: Etienne Marcotte [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 08, 2001 2:24 PM
> Cc: 'Michael D. Risser'; [EMAIL PROTECTED]
> Subject: Re: Comparison problem
>
>
> In my previous post I used -f for missing file, bu
In my previous post I used -f for missing file, but -f is for a file
present so it would either go into a else, or check which one is the
missing file flag, I think it's -e :-/
Etienne
Bob Showalter wrote:
>
> > -Original Message-
> > From: Michael D. Risser [mailto:[EMAIL PROTECTED]]
>
oops it's -f
and after reading Bob's reply you need to remove . and ..
so:
print "Number of files to process:" $#fileNames-1; # maybe with
dots between the parts
print "\n Press any key to continue, Ctrl-C to exit\n";
chomp(my $in=);
for(0..$#fileNames-2) {
if (-f) {
> -Original Message-
> From: Michael D. Risser [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 08, 2001 11:01 AM
> To: [EMAIL PROTECTED]
> Subject: Comparison problem
>
>
> I have a script which in part takes a list of files in a
> directory (the name
> of each file is a number),
#|--Remove Before Flight-->
print "Number of files to process:" $#fileNames+1 "\n"; # maybe with
dots between the parts
print "Press any key to continue, Ctrl-C to exit\n";
chomp(my $in=);
#<--Remove Before Flight--|
# Go through each file we found
for(0..$#fileNames) {
if (-e $