Re: unlink ($files);
| From: | Jason Sheets | Date: | Wed, 08 Jan 2003 20:59:52 +0000 |
| Subject: | Re: unlink ($files); | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130803@lists.php.net to get a copy of this message | ||
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.
Jason
2003-01-08 at 07:24, Adam Voigt wrote:
> 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 really want to
> do a
> recursive deletion (i.e., remove both a directory and everything under
> it) you
> could use:
>
> exec("/bin/rm -rf path/$name-of-dir-to-be-erased");
>
> Just be very sure about what your doing (multiple checks on the
> variable's
> value to make sure your not erasing anything you don't want to) cause
> this
> command, when executed with the proper permissions, will kill any
> directory
> and everything under it.
>
> On Wed, 2003-01-08 at 00:29, rw@xend.net wrote:
>
> 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/00000000/htdocs/2003/_admin/del_listing_action.php
> on line 16
>
> Warning: RmDir failed (File exists) in
> /mnt/ls6/17/169/00000000/htdocs/2003/_admin/del_listing_action.php
> on line 17
>
> Thanks
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> Adam Voigt (adam@cryptocomm.com)
> The Cryptocomm Group
> My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc