PHP Delete Directory
- Started
- Last post
- 4 Responses
- ldww
i need to make a php to delete everything inside a certain directory, but not the actual directory (it will contain a bunch of folders and files) i was looking at this
http://us4.php.net/manual/en/fun…
but it seems to only delete an actual dir
- ldww0
that looks like it will only delete files.
the folder will contain files and directorys.
- ldww0
nm, i used:
// this wipes the entire
// directory clean (empty or not)$path = "/path/to/empty";
$cmd = "rm -rf $path";
`$cmd`;
- rabattski0
oooh hold on. check the comments on php.net at unlink() and rmdir(). there's an example somewhere for deleting a folder content (including subdir's etc). what you try to do is possible but depends on your php config (because that's not an php command but a *nix command (that rm -rf bit)) if it allows command lines execution.