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 > 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.
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.
Look through some of the user submitted comments for
rmdir(). One is probably going to be what you need....
Worked Awsome, all the time I could of saved if I just would of asked.
$file = $path . $it;
exec("rm -rf $file");
Users Browsing this Thread
There are currently 1 users browsing this thread.
(0 members and 1 guests)