Forum Moderators: coopster & phranque

Message Too Old, No Replies

Checking if many files are there

How can I make it stop?

         

adni18

12:57 pm on Oct 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if this is my directory:

r1.txt
r2.txt
r3.txt
r4.txt
r5.txt
(of course, test.cgi)

is it possible to open up all files that go r#.txt, where # is the next number in line? I was thinking something like this, but it doesn't quite work:

$i=0;
return;
while (return;i++)
{
if(-e "/r$i.txt")
{
return;
print "r$i.txt is there!";
}
else
{
}
}

jatar_k

5:23 pm on Oct 16, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



not sure if that path is right

if the files are in the same dir as the script you should only need

if(-e "r$i.txt")