🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Cannot delete a directory

#763
From: Ed Mulroy [TeamB]
Date: Mon, 07 Jan 2008 14:29
30 lines
2025 bytes
I don't know how rename can delete a file.  DeleteFile, remove and unlink 
all can do that and are provided.  Try using one of them.

If the directory in question is selected as the current directory then it is 
active and Windows will block its deletion.  You can find the current 
directory setting with GetCurrentDirectory and alter it with 
SetCurrentDirectory.

All of DeleteFile, GetCurrentDirectory and SetCurrentDirectory are Win32 API 
functions.

> My program uses findfirst ...

Don't forget to use findclose after finishing with findfirst and findnext.

.  Ed

> Jos� wrote in message
> news:ne94o39s71g92csaaup85ufdomjisjvu4h@4ax.com...
>
> My program uses findfirst() and rename() to remove all files from
> a folder. And then it executes RemoveDir() and this fails.
>
> When I try to remove the empty folder with the Windows Explorer,
> this fails.
>
> When I close my C++ program, I can remove the folder with the
> Explorer.
>
> It appears that my program locks the folder. Is there a remedy?
Technical Details
Message-ID: <4782373a$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feed.tweaknews.nl!217.73.144.44.MISMATCH!ecngs!feeder.ecngs.de!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <ne94o39s71g92csaaup85ufdomjisjvu4h@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,aa6e00669d5b96c9
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII
From: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <ne94o39s71g92csaaup85ufdomjisjvu4h@4ax.com>
Subject: Re: Cannot delete a directory
Date: Mon, 7 Jan 2008 09:29:12 -0500
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 71.77.53.190
Message-ID: <4782373a$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1199716154 71.77.53.190 (7 Jan 2008 06:29:14 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feed.tweaknews.nl!217.73.144.44.MISMATCH!ecngs!feeder.ecngs.de!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail