X

Rate Us :



Share with Friends :

Menu

PHP-Directory Functions :

mkdir :

By using this function, we can create new directory.

Example :

<?php mkdir("C :/abcd"); ?>


rmdir :

By using this function, we can remove existing directory.

Example :

<?php rmdir("C :/abcd"); ?>


opendir :

By using this function, we can open a directory.

Example :

<?php $dh = opendir("E :/abcd"); ?>


readdir :

By using this function, we can read the files of a directory.


closedir :

By using this function, we can close the opened directory.

Example :

<?php $dh = opendir("C :/XAMPP"); while($file = readdir($dh)) { echo $file."\n"; } ?>


scandir :

By using this function, we can scan all files of a directory & returns the output in the form of an Array.

Example :

<?php $arr = scandir("C :/XAMPP"); print_r($arr); ?>


getewd :

By using this function, we can get the current working directory.

Example :

<?php echo getewd(); ?>


chdir :

By using this function, we can change the current working directory location.

Example :

<?php chdir("e :/"); $fp = Fopen("1.jpg", "r"); ?>