Solved

RemoveDir under NT

Posted on 1998-08-18
5
199 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA Import all database objects 12 50
Microsoft Query from QuickBooks 9 66
C#: need to import an entire CSV file 4 55
Question to Pivot table 1 51
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

816 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

12 Experts available now in Live!

Get 1:1 Help Now