Solved

RemoveDir under NT

Posted on 1998-08-18
5
193 Views
Last Modified: 2013-12-03
i can not remove a directory, when i delete a file in
this dir before.
After the programm terminate, the dir is removable.
It is not the current dir.
In Win95 it works, under NT not.
0
Comment
Question by:moin072898
5 Comments
 
LVL 4

Expert Comment

by:agreen
ID: 1413614
1) The RemoveDir function deletes an existing EMPTY directory.
2) Your process must have delete access to the directory.
0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 50 total points
ID: 1413615
You can't RemoveDir if (1) the dir is not empty, OR (2) under NT a currrently running process has the dir as its working directory.

I suspect your problem is (2).  Answer is to change the current working directory immediately before doing RemoveDir.  
Either use SetCurrentDirectory (API) or
or use _chdir in direct.h (or _wchdir in wchar.h for Unicode programs)

Call it with another directory before removing the directory you want to directory.
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1413616
Oops, last sentence should have read

Call it with another directory before removing the directory you want to remove.

Anyway answer is unchanged
   
 

0
 
LVL 22

Expert Comment

by:nietod
ID: 1413617
You also can't remove a directory if there is an open search handle to the directory.
0
 
LVL 2

Expert Comment

by:sprinkmeier
ID: 1413618
Also, if there is ao open UpdateNotify handle (it's used by programs like UltraEdit, J Builder etc. to let it know if a file has changed and needs to be reloaded).
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now