Re: [wdvltalk] PHP: determine if a directory is empty

2005-06-09 Thread Galatek Webmaster
just add a line to check for an empty string in $file and break the loop after printing the message you want to print. i.e. $continue = true; /* Set a BOOLEAN variable to keep the loop going as long as there are files */ if ($handle = opendir('./ssgi/')) { while (false !== ($file =

RE: [wdvltalk] PHP: determine if a directory is empty

2005-06-09 Thread Gerenday, Perry (P.)
Subject: Re: [wdvltalk] PHP: determine if a directory is empty just add a line to check for an empty string in $file and break the loop after printing the message you want to print. i.e. $continue = true; /* Set a BOOLEAN variable to keep the loop going as long

Re: [wdvltalk] PHP: determine if a directory is empty

2005-06-09 Thread Sheila Fenelon
How about this? $empty_dir = true; if ($handle = opendir('./ssgi/')) { while (false !== ($file = readdir($handle))) { if ($file != . $file != ..) { echo a href=\ssgi/$file\$file/abr /\n; $empty_dir = false; } } closedir($handle); } if ($empty_dir) { echo

Re: [wdvltalk] PHP: determine if a directory is empty

2005-06-09 Thread Galatek Webmaster
:[EMAIL PROTECTED] Sent: Thursday, June 09, 2005 11:01 AM To: wdvltalk@lists.wdvl.com Subject: Re: [wdvltalk] PHP: determine if a directory is empty just add a line to check for an empty string in $file and break the loop after printing the message you want to print. i.e. $continue = true

RE: [wdvltalk] PHP: determine if a directory is empty

2005-06-09 Thread Gerenday, Perry (P.)
Sheila Fenelon wrote: How about this? $empty_dir = true; if ($handle = opendir('./ssgi/')) { while (false !== ($file = readdir($handle))) { if ($file != . $file != ..) { echo a href=\ssgi/$file\$file/abr /\n; $empty_dir = false; } }

RE: [wdvltalk] PHP: determine if a directory is empty

2005-06-09 Thread Steven Olson
Hi - My idea of sending to a file and counting the lines is essentially the same as several other suggestions: 1) Charles King suggested outputting to a array and then checking the contents of the array, and 2) Pat Richards suggested adding a counter, which would have exactly the same effect

RE: [wdvltalk] PHP: determine if a directory is empty

2005-06-08 Thread Pat Richard
Without actually trying it, the first thing that comes to mind is to insert a counter in your while loop. If, at the conclusion of the loop, it only == 2, then you're likely in an empty directory (you'd have the . And .. To give you the two). Make sense? -Original Message- From:

Re: [wdvltalk] PHP: determine if a directory is empty

2005-06-08 Thread Stephen Caudill
Pat Richard wrote: Without actually trying it, the first thing that comes to mind is to insert a counter in your while loop. If, at the conclusion of the loop, it only == 2, then you're likely in an empty directory (you'd have the . And .. To give you the two). Make sense? Something I nabbed

RE: [wdvltalk] PHP: determine if a directory is empty

2005-06-08 Thread Steven Olson
Hi Perry - If you write the output to a file, instead of to the screen, then you can simply test the number of lines in the ASCII file to see if there is a line for a file, and based on that return either the report you have in the file or your text string. Hope I'm clear on this. This is how I