Article View: borland.public.delphi.nativeapi
Article #12085Re: RemoveDir problem
From: Mark Williams
Date: Mon, 25 Nov 2002 14:03
Date: Mon, 25 Nov 2002 14:03
42 lines
2132 bytes
2132 bytes
Nik,
If you do a findFirst on your "empty" directory you'll probably find that it
isn't empty after all. I don't know why but the folders sometines have
garbage folders/files in them which are hidden from view. I went through
exactly the same problem as you several weeks ago.
In the end I created the following routine, which empties the directory
before removing it.
If you use it, you have to be sure the directory is empty. I only use it on
temp files, which I note is the specific example you are using.
procedure DeleteDir(Dir:String);
var sr:TSearchRec;
begin
if findfirst(dir+'*.*', faAnyFile, sr)=0 then
DeleteFile(Dir+sr.Name);
while FindNext(sr)=0 do
DeleteFile(Dir+sr.Name);
FindClose(sr);
RemoveDir(dir);
end;
Regards,
Mark
Nik <nikb2002@nospam.com> wrote in message
news:3de21f0e$1@newsgroups.borland.com...
>
> "Rick Betting" <rick@ATonlinegroepDOT.nl> wrote:
> >
>
>RemoveDir(IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName)
)
> >+ 'Temp');
>
> ok, IncludeTrailingBackslash doesn't help me! it is similar to
> IncludeTrailingPathDelimiter.
>
> Nik B.
Technical Details
Message-ID:
<3de22dfb$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-04!supernews.com!newsfeed.gamma.ru!Gamma.RU!fu-berlin.de!news.uni-x.net!newsgroups.borland.com!not-for-mailReferences:
<3de20ad9$1@newsgroups.borland.com> <3de20fd0$1@newsgroups.borland.com> <3de21f0e$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f94dd,cece786f25c52b92 X-Google-Attributes: gidf94dd,public X-Google-ArrivalTime: 2002-11-25 06:15:49 PST From: "Mark Williams" <m.williams77@ntlworld.com> Newsgroups: borland.public.delphi.nativeapi References: <3de20ad9$1@newsgroups.borland.com> <3de20fd0$1@newsgroups.borland.com> <3de21f0e$1@newsgroups.borland.com> Subject: Re: RemoveDir problem Date: Mon, 25 Nov 2002 14:03:54 -0000 Lines: 44 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 NNTP-Posting-Host: 81.101.154.207 Message-ID: <3de22dfb$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1038233083 81.101.154.207 (25 Nov 2002 06:04:43 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-04!supernews.com!newsfeed.gamma.ru!Gamma.RU!fu-berlin.de!news.uni-x.net!newsgroups.borland.com!not-for-mail