🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #166

extended file search

#166
From: Sören Zimmermann
Date: Mon, 30 Jun 2008 13:28
38 lines
1885 bytes
Hi all,

I've got a problem and don't know how to do best:

I need to delete some files from a directory (including subdirs). The 
joke is, that we need a complex file definition which file to delete and 
which one not. We need include files and exclude files, account for file 
size etc.

A small example:


TStringList *IncludedFiles, *ExcludedFiles;
IncludedFiles->Add("*.bmp");
IncludedFiles->Add("*.gif");
ExcludedFiles->Add("Default.*");

When executing the code (e.g. a class or component) in a directory 
containing the files
  (1) Default.bmp
  (2) foo.bmp
  (3) Default.gif
  (4) HelloYou.gif
  (5) YetAnotherFile.txt

only the files (2) and (4) should be affected.

So what I need is an idea of code (or maybe some existing component) of 
how to create a list of all files matching the definitions.

Of course I could use FindFirstFile/FindNextFile, but then I will only 
get a list of files matching my include files. How can I filter out my 
exclude files, esp. when they contain wildcards?


Thanks for some ideas,

S�ren
Technical Details
Message-ID: <4868dffe$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!feeder.erje.net!news.isoc.lu!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6bc3b3cc44e0a25,start
X-Google-Attributes: gid10cc67,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII
Date: Mon, 30 Jun 2008 15:28:19 +0200
From: Sören Zimmermann
 <soeren.zimmermann@sef-softec.de>
User-Agent: Thunderbird 2.0.0.14 (Windows/20080421)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: extended file search
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 80.152.149.77
Message-ID: <4868dffe$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1214832638 80.152.149.77 (30 Jun 2008 06:30:38 -0700)
Lines: 38
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!feeder.erje.net!news.isoc.lu!newsgroups.borland.com!not-for-mail