Bug when deleting folder with open handles

When you delete a folder that has some open files, an error message is shown "An error occurred deleting 'some_folder': The directory is not empty. (145)".

After killing the processes that had files open in that folder, the "Retry" button in Directory Opus doesn't work (it pops the same error message). So I have to skip (or abort) and delete again...

On a side note, shouldn't the error message say that some files are in use? I think I remember Windows Explorer showing me such a message... (and if you can add the PID/names of the offending processes, it would be even better!)

If you delete without using the recycle bin, Opus will tell you the processes if the Windows API for finding them can tell it. (The API is not entirely reliable, however.)

If you delete to the recycle bin, whatever happens is up to the Windows shell.

Before the error about the directory not being empty, did you get other errors about individual files, which were skipped? Or is that the one and only error message for the whole operation?

Things can be complicated depending on how the files are opened by other software. For example, a file may be open in a way which allows it to be deleted. The request to delete it will succeed, and everything looks good, until trying to delete the folder the file is in. That will then fail because the "deleted" file actually sticks around until the thing that has it open has closed it. It's in a limbo "pending deletion" state where it can no longer be opened but it is still there taking up a directory entry, preventing another file of the same name being created or the folder it is in being deleted. In that situation, the error message is correct. There was no error deleting the file (that succeeded; it's just in a pending state) and the reason the folder can't be deleted is that it is not yet empty.

Indeed, it's the last scenario you mention that is happening to me in this precise case.

I delete a folder where some files are read-open, without using the recycle bin. Then at some point I get the message "directory not empty" (there are no errors before that). So I go and close the offending process. The bug is that at this point, clicking "retry" just pops the same error message again and again, until I abort (or skip) and delete the folder again.

Hmm, the retry part should work. I've not tried to reproduce that yet but have in our queue to take a look at.