Solved

RemoveDir under NT

Posted on 1998-08-18
5
202 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…

730 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