Create Directory
mkdir(“testdir”);
Remove Directory
rmdir(“testdir”);
Open a Directory for Reading
$dh = opendir(“testdir”);
Reading the contents of Directory
$dirname=”.”;
$dh = opendir($dirname) or die (“Couldn’t open dir”);
while(!(($file = readdir($dh)) === false)){
if (is_dir(“$dirname/$file”)){
echo “(D)”;
}
echo $file.”<br/>”;
}
closedir($dh);



0 Comments on “Directory operation in PHP”
Leave a Comment