Hi,
You can use the backtick operator to delete whatever you have
permissions to delete:
$directory = "path/*.*";
`rm -rf $directory`;
They aren't quotes, they are backticks (to the left of the 1 key on most
keyboards). It is very useful for any command line stuff you have
permissions to do.
B
That will usually work on Unix but will not work on Windows. Rather than
executing an external program you can use PHP itself to do a recursive
delete.
There are examples at http://www.php.net/manual/en/function.rmdir.php if
you read the user notes you will see several posts about doing this.
Jas
Can't do wildcards like * because thats something that as I found out a few
days ago, is expanded by the shell into a full command, so because your not
running a shell, it can't be expanded and the raw unlink call to *.* fails because
the unlink function doesn't understand wildcards. If you
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hey,
You can't delete the files all at onceyou have to delete them one by one
or use this function that will remove full directories.
- -
function force_rmdirs($dir) {
$dh = opendir($dir);
while(false !== ($file = readdir($dh))) {
Ok, Jason, here's another one!
I think I've read how to delete a file.
I need to delete 25 files, then do a rmdir(blah);
Line 16: $directory = "path/*.*";
Warning: Unlink failed (No such file or directory) in
/mnt/ls6/17/169//htdocs/2003/_admin/del_listing_action.php on line 16
Warning
5 matches
Mail list logo