Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2007
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do I delete a folder?

    Hi,

    I want to delete a folder on the server using php code. I can only find the code to delete files from the server and not the folder with files.

    I searched Google and php.com but all I get is:

    #$myFile = "filetodlete";
    #unlink($myFile);

    ---------------------------------

    #$myFile = "filetodelete";
    #ftp_delete($myFile);


    Is there something I can change or a other code I can use to delete folders?

    Thanks

  • #2
    New Coder
    Join Date
    Apr 2007
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Found it and Got it working!

    Just for all of you who would like to delete folders in the future here is the code.

    -------------------------------
    $dfolder = $_POST['dfolder'];


    $myFile = "$dfolder";
    rmdir($myFile);
    ----------------------------
    Just write your own form for it....



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •