From: Shaun Thornburgh on

Hi,

I need to delete a file with any file extension where i know the name of the file, is it possible to use regular expressions with the unlink function?

Thanks

_________________________________________________________________
http://clk.atdmt.com/UKM/go/197222280/direct/01/
We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
From: Adrian on
Use glob() to get a list of matching afiles nd then unlink() them
separately.


> I need to delete a file with any file extension where i know the
> name of the file, is it possible to use regular expressions with the unlink function?

From: cheran krishnamoorthy on
You can't use regular expression with unlink directly.
have a look on this
http://www.phpfreaks.com/forums/index.php?topic=256367.0

<http://www.phpfreaks.com/forums/index.php?topic=256367.0>Regards
Cherankrish

On Tue, Jun 15, 2010 at 4:17 PM, Shaun Thornburgh <
shaunthornburgh(a)hotmail.com> wrote:

>
> Hi,
>
> I need to delete a file with any file extension where i know the name of
> the file, is it possible to use regular expressions with the unlink
> function?
>
> Thanks
>
> _________________________________________________________________
> http://clk.atdmt.com/UKM/go/197222280/direct/01/
> We want to hear all your funny, exciting and crazy Hotmail stories. Tell us
> now
>
From: "Tanel Tammik" on

"Shaun Thornburgh" <shaunthornburgh(a)hotmail.com> wrote in message
news:BAY148-w43CAAC3698E0134DFACC28ABDD0(a)phx.gbl...

Hi,

I need to delete a file with any file extension where i know the name of the
file, is it possible to use regular expressions with the unlink function?

Thanks

_________________________________________________________________
http://clk.atdmt.com/UKM/go/197222280/direct/01/
We want to hear all your funny, exciting and crazy Hotmail stories. Tell us
now

Hi,

use glob() and then unlink with array_walk()

Br
Tanel


From: Ashley Sheridan on
On Tue, 2010-06-15 at 16:23 +0530, cheran krishnamoorthy wrote:

> You can't use regular expression with unlink directly.
> have a look on this
> http://www.phpfreaks.com/forums/index.php?topic=256367.0
>
> <http://www.phpfreaks.com/forums/index.php?topic=256367.0>Regards
> Cherankrish
>
> On Tue, Jun 15, 2010 at 4:17 PM, Shaun Thornburgh <
> shaunthornburgh(a)hotmail.com> wrote:
>
> >
> > Hi,
> >
> > I need to delete a file with any file extension where i know the name of
> > the file, is it possible to use regular expressions with the unlink
> > function?
> >
> > Thanks
> >
> > _________________________________________________________________
> > http://clk.atdmt.com/UKM/go/197222280/direct/01/
> > We want to hear all your funny, exciting and crazy Hotmail stories. Tell us
> > now
> >


Make sure you don't accidentally delete files you need. Once you've got
the list of files with the glob() function as Adrian mentioned, don't
just loop through and delete them all, as you could end up removing a
file which you really need later.

Thanks,
Ash
http://www.ashleysheridan.co.uk