1

I am developping a application. Sometimes, I want to completely delete the building directory.

When I do this I get an error from Windows, that either I don't have acess or some file(s) in the directory is/are open.

Well, when I go down into the hierarchy of this directory, at some point I may delete everything, and when I go up again in the hierarchy, I'm able to delete everything, even the topmost directory I wanted to delete first.

So I'm able to do what I want but it is kind of a hassle.

Any idea why Windows is behaving this way ?

1
  • @John. I'm in the early stage of the development (i.e. prototyping the GUI), there is still strictly nothing that I need to store anywhere yet.
    – Jacques
    Commented Oct 24, 2020 at 14:50

2 Answers 2

0

This is just a shot in the dark, but my best guess is, there is a background process which scans the files in your "building" directory, and as long as this process did not complete its task, it may block the deletion.

This could be either a process of your version control system (like TortoiseSVN or TortoiseGit, trying to update information for overlay icons in the Windows explorer), or your malware scanner, scanning all new files with some delay. When a build produces or touches several hundred files, the delayed scanning may require a few minutes to complete.

0

If I were to hazard a guess I would assume that you are not calling .Dispose or are not correctly using to instantiate file resources. Do you get the same error message on the first instance of compile&run after a fresh system reboot? If the issue is not present, but then occurs on the second time, you are simply not freeing your resources correctly.

2
  • It seems your answer is assuming the OP is talking about a program written by themselves which is failing with the deletion? I see no indication for this in the question.
    – Doc Brown
    Commented Oct 24, 2020 at 16:50
  • Ohh so: "I am developping a application. " does not indicate this?
    – paddywan
    Commented Oct 24, 2020 at 18:27

Not the answer you're looking for? Browse other questions tagged .