www.webdeveloper.com
Results 1 to 4 of 4

Thread: Deleting Files.

  1. #1
    Join Date
    Apr 2003
    Posts
    31

    Deleting Files.

    I making a Shopping site, and I have a admin panel I'm making that makes the categories, and items and it all works good, except for delete.

    Say I have a category called Snowmobile in qoutes are thr urls, and it was set up as follows..

    Snowmobile (site.com/shop/Snowmobile/)
    Snowmobile > Oils & Lubes (site.com/shop/Snowmobile/Oils_Lubes/)
    Snowmobile > Oils & Lubes > 2 Cycle (site.com/shop/Snowmobile/Oils_Lubes/2_Cycle/)
    Snowmobile > Oils & Lubes > 4 Cycle (site.com/shop/Snowmobile/Oils_Lubes/4_Cycle/)
    Snowmobile > Tracks (site.com/shop/Snowmobile/Tracks/)
    Snowmobile > Riding Gear (site.com/shop/Snowmobile/Riding_Gear/)
    Snowmobile > Riding Gear > Gloves (site.com/shop/Snowmobile/Riding Gear/Gloves)
    Snowmobile > Riding Gear > Gloves > Thor (site.com/shop/Snowmobile/Riding Gear/Gloves/Thor)

    Now each of those directories has a file I made called index.php

    What If I wanted to delete Snowmobile directory and everything in it, see I can't just rmdir I need to go in there delete all the files and directories first.

    Any ideas?

  2. #2
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    Yeah, I think you are going to have to loop through the files in the directory and delete them first. You will also have to loop through sub-directorys and delete the files inside them. You use unlink() to delete files.

  3. #3
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    Look through some of the user submitted comments for rmdir(). One is probably going to be what you need....

  4. #4
    Join Date
    Apr 2003
    Posts
    31
    Code:
    		$file = $path . $it[0];
    		exec("rm -rf $file");
    Worked Awsome, all the time I could of saved if I just would of asked.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles