Home  >  Article  >  Backend Development  >  Create and delete directories or files

Create and delete directories or files

WBOY
WBOYOriginal
2016-07-25 09:01:37936browse
Create and delete directories or files ​ ​ ​ ​ ​ ​ ​ ​ ​
                 
                                                                                                                                                                                                                                                                                                       


function mkdirs($directory)
{
             echo $directory;
  1.                                                                                                                                                 77))
  2.                                                                                                                          else
  3.                                                                                                                  return false;
  4. Copy code
  5.                                                                                                                                                                                                                                                                                              


    function delete_directory($directory){
                                                                                                                                                                                                    while ( $ FILENAME = Readdir ($ DH)) {
      IF ($ FILENAME! = "." && $ FILENAME! = "..") {
    1. // is the file. .$filename)){
    2.                                                                                                                                                                                                                                    //Recursively delete subfolders or files if the directory is not empty
    3.                                                                                                                                                     // Recursively delete subfolders or files
    4.                                                   );}}
    5. }} @@Closedir ($ dh);
    6. RMDIR ($ Directory);
    7. }} else {
    8. // Delete a specified file
    9. (File_exist ($ Directory)) {
    10. unlink ($directory);
    11.                                                                                                                           
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn