RE: [PHP] different operations on files than dirs

From: Date: Thu, 16 Nov 2000 06:42:50 +0000
Subject: RE: [PHP] different operations on files than dirs
Groups: php.general 
Request: Send a blank email to php-general+get-25636@lists.php.net to get a copy of this message
function GetDirCount ($sPath) { $handle=opendir ($sPath); while ($file=readdir($handle)){ $count++; } return ($count); } function Get_File_List($sPath) { global $dir_array,$file_array; if(!$sPath) { $sPath = "."; } $dir_handle = opendir($sPath); $count = $a = 0; while($file = readdir($dir_handle)) { if (is_dir ("/$sPath/$file") { $dir_array [$count]= array($file,GetDirCount ("$sPath/$file")); $count++; } else { $file_array [$a]= array($file,filesize ("$sPath/$file"),date("F j Y h:i:s A", filemtime("$sPath/$file") ) ); $a++; } } } $dir_array=array(); $file_array=array(); Get_File_List ("."); Files are listed in file_array Directories are listed in dir_array -----Original Message----- From: Kevin Ferron [mailto:kevin_ferron@hotmail.com] Sent: November 16, 2000 05:36 PM To: php-general@lists.php.net Subject: [PHP] different operations on files than dirs I'm stuck.. variations on the following code is what I've been trying: $handle=opendir($this->dirshow); while (false!==($file = readdir($handle))) { if ($file != "." && $file != "..") { if (is_dir($file) == 1) { STUFF I WANT TO HAPPEN IF ITS A DIR } elseif (is_dir($file) == 0) { IF ITS A FILE } Thanks for your help. phool -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#25636) next »