note 18385 added to function.readdir

From: Date: Mon, 21 Jan 2002 02:32:03 +0000
Subject: note 18385 added to function.readdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-25600@lists.php.net to get a copy of this message
I use this small code, to diferentiate a file from a directory, if its a directory then I link it again but $basedir = $basedir . "/" . $file; (you get the point) or if its a file then I link the file to my jukebox page. <? $BaseDir = "/home/acidfilez/public_html/mp3/"; $flz = $BaseDir . "/."; $dir=opendir ("$flz"); while ($file = readdir($dir)) { if ($file == "." || $file == "..") continue; { $tempo = "/" . $file; if (is_dir ("$tempo")) //checks if a filo or a { //Directories echo "$file is a directory <br>"; } else {//Files //$file = substr("$file", -4); //removes .mp3 echo"$file is a file <br>"; }; }; }; closedir($dir); ?> email me if you need further help to: Magno Cardona Heck acidfilez@entelchile.net -- http://www.php.net/manual/en/function.readdir.php http://master.php.net/manage/user-notes.php?action=edit+18385 http://master.php.net/manage/user-notes.php?action=delete+18385 http://master.php.net/manage/user-notes.php?action=reject+18385

« previous php.notes (#25600) next »