Re: Unlink question more or less
| From: | Tom Ray | Date: | Wed, 12 Jun 2002 14:05:36 +0000 |
| Subject: | Re: Unlink question more or less | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101735@lists.php.net to get a copy of this message | ||
Any word on when glob() will be in the production version?
thanks for the help Miquel.
----- Original Message -----
From: "Miguel Cruz" <mnc@stoic.net>
To: "Tom Ray" <tom@blazestudios.com>
Cc: <php-general@lists.php.net>
Sent: Wednesday, June 12, 2002 2:01 AM
Subject: Re: [PHP] Unlink question more or less
> On Tue, 11 Jun 2002, Tom Ray wrote:
> > I want to use unlink() to delete a wildcard, but at the moment I keep
> > getting parse errors. Here's what happening:
> >
> > I'm mucking around with some login stuff, when a user logs in it writes
> > a flat file that collects some information about them, the flat file is
> > created with the name username.dateyeartime Now each time they log in I
> > want to delete that file and replace it with the new file that has the
> > latest dateyeartime ending on it. I've tried unlink (username.*); but
> > that returns an error. Is there a way for unlink() to recongize
> > wildcards? If not how would I do this?
>
> Once glob() makes it into the production version,
>
> foreach(glob('*') as $f) unlink($f);
>
> Until then, use system('rm *'); or a readdir loop.
>
> unlink() is not the rm command. It's a system call that deletes a specific
> named file.
>
> miguel
>
>