[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

RemoveDir under NT

Posted on 1998-08-18
5
Medium Priority
?
208 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 100 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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 …
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…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

656 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