Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Delete Directory and Files Recursively Through php Script

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1
    Comment on it

    Hello all,

    If you want to delete all directory and files recursively by using php script, for this please follow the below mentioned code.

    <?php
    function deleteDirectory($filename) {
    if(is&#95;dir($filename))
    $handle = opendir($filename);
    if(!$handle)
    return false;
    while($file = readdir($handle)){
    if($file != "." && $file != ".."){
    if(!is&#95;dir($filename."/".$file))
    unlink($filename."/".$file);
    else
    deleteDirectory($filename.'/'.$file);
    }
    }
    closedir($handle);
    rmdir($filename);
    return true;
    }
    ?>
    
    how to delete directories and files recursively in php

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: