🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #2100

Re: Deleting some files with a given extension

#2100
From: Jon Skeet
Date: Thu, 14 Jun 2001 10:26
24 lines
2185 bytes
Laurent Souriau <lsouriau@club-internet.fr> wrote:

> I currently have the following problem :
> 
> I have a directory, let ' s say : d:\Temp\
> containing some files with different names.
> 
> The files have the following syntax names : RepSQL*.tmp
> 
> where * is unknown to the programmer.
> 
> I would like to create File toto = new File("d:\Temp\RepSQL*.tmp");
> and then delete this file with toto.delete();

See File.listFiles (FilenameFilter)

- you just have to create a FilenameFilter that returns true when names 
of the form RepSQL*.tmp are passed to it (eg by testing 
name.startsWith ("RepSQL") && name.endsWith (".tmp"))

-- 
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Technical Details
Message-ID: <MPG.1592a1bff560aa3e989718@mrmog.peramon.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!newsfeed.gamma.ru!Gamma.RU!f.de.uu.net!lnewspeer01.lnd.ops.eu.uu.net!lnewspost00.lnd.ops.eu.uu.net!emea.uu.net!not-for-mail
References: <9ga32n$t3t$1@s1.read.news.oleane.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10568c,ede28868063ec521
X-Google-Attributes: gid10568c,public
X-Google-Thread: f631b,ede28868063ec521
X-Google-Attributes: gidf631b,public
X-Google-Thread: 1089d0,ede28868063ec521
X-Google-Attributes: gid1089d0,public
X-Google-Thread: f74b3,ede28868063ec521
X-Google-Attributes: gidf74b3,public
X-Google-Thread: 10a146,ede28868063ec521
X-Google-Attributes: gid10a146,public
X-Google-Thread: 113ae9,ede28868063ec521
X-Google-Attributes: gid113ae9,public
X-Google-ArrivalTime: 2001-06-14 03:26:56 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!newsfeed.gamma.ru!Gamma.RU!f.de.uu.net!lnewspeer01.lnd.ops.eu.uu.net!lnewspost00.lnd.ops.eu.uu.net!emea.uu.net!not-for-mail
From: Jon Skeet <skeet@pobox.com>
Newsgroups: borland.public.jbuilder.java.api,borland.public.jbuilder.java.language,comp.lang.java.help,comp.lang.java.programmer,de.comp.lang.java,fr.comp.lang.java
Subject: Re: Deleting some files with a given extension
Date: Thu, 14 Jun 2001 11:26:51 +0100
Message-ID: <MPG.1592a1bff560aa3e989718@mrmog.peramon.com>
References: <9ga32n$t3t$1@s1.read.news.oleane.net>
Organization: Peramon Technology Ltd.
X-Newsreader: MicroPlanet Gravity v2.30
Lines: 24
NNTP-Posting-Host: fw1.peramon.com
X-Trace: 992514415 reading.news.pipex.net 15030 193.132.195.113
X-Complaints-To: abuse@uk.uu.net