Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

RemoveDir under NT

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
moin072898
Asked:
moin072898
1 Solution
 
agreenCommented:
1) The RemoveDir function deletes an existing EMPTY directory.
2) Your process must have delete access to the directory.
0
 
Answers2000Commented:
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
 
Answers2000Commented:
Oops, last sentence should have read

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

Anyway answer is unchanged
   
 

0
 
nietodCommented:
You also can't remove a directory if there is an open search handle to the directory.
0
 
sprinkmeierCommented:
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

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now