🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Deleting some files with a given extension

#2101
From: Cristi
Date: Thu, 14 Jun 2001 11:28
40 lines
2727 bytes
You can make a class which implements interface FilenameFilter (override
accept method).
Then create a File object from you directory path, and call listFiles method
and give it as argument
an instance of your class which implements FilenameFilter .

This should return only the files you want. Iterate through that list and
call delete on each file.

HTH,
Cristi

PS: you can find out in API documentation how to do this. If you can't,
write again and I'll give a sample.

Laurent Souriau <lsouriau@club-internet.fr> wrote in message
news:9ga32n$t3t$1@s1.read.news.oleane.net...
>         Hi eveyone,
>
>
> 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();
>
> How can I do that ?
>
> Thank you for your help
>
> Laurent
> E-mail : lsouriau@club-internet.fr
>
>
Technical Details
Message-ID: <9ga6ud$hue$1@nebula.dnttm.ro>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!64.86.63.5.MISMATCH!nntp1.njy.teleglobe.net!teleglobe.net!news.taide.net!news.dnttm.ro!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: 113ae9,ede28868063ec521
X-Google-Attributes: gid113ae9,public
X-Google-Thread: 1089d0,ede28868063ec521
X-Google-Attributes: gid1089d0,public
X-Google-Thread: 10a146,ede28868063ec521
X-Google-Attributes: gid10a146,public
X-Google-Thread: f631b,ede28868063ec521
X-Google-Attributes: gidf631b,public
X-Google-Thread: f74b3,ede28868063ec521
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-14 04:32:14 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!64.86.63.5.MISMATCH!nntp1.njy.teleglobe.net!teleglobe.net!news.taide.net!news.dnttm.ro!not-for-mail
From: "Cristi" <bcristi@innovative.ro>
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 14:28:31 +0300
Organization: Dynamic Network Technologies Timisoara
Lines: 42
Message-ID: <9ga6ud$hue$1@nebula.dnttm.ro>
References: <9ga32n$t3t$1@s1.read.news.oleane.net>
NNTP-Posting-Host: 193.230.236.217
X-Trace: nebula.dnttm.ro 992517901 18382 193.230.236.217 (14 Jun 2001 11:25:01 GMT)
X-Complaints-To: newsmaster@news.dnttm.ro
NNTP-Posting-Date: 14 Jun 2001 11:25:01 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300