1 Attachment(s)
Removing a directory in windows( When a file already opened from that directory)
Hi,
I can able to remove the files and sub directories and the diectory also.
But is it possible to delete a directory when any one of the files of that opend.
Generally if we try manually to delete a folder, when a file opened from that directory, windows throw an err as " can not delete <dirName> : It is being used by another person or program".
Can we manage this error in coding and can delete the directoty.
Please let me know
Thanks in Advance.
Sri
Re: Removing a directory in windows( When a file already opened from that directory)
What's supposed to happen to the open file then? You're talking about messing with operating system functions. No, you can't.
Re: Removing a directory in windows( When a file already opened from that directory)
Quote:
Can we manage this error in coding and can delete the directoty.
No, that is the system behaviour. When a file is opened, it cannot be deleted, not the folder where it is located.
Re: Removing a directory in windows( When a file already opened from that directory)
Quote:
Originally Posted by sri_1221
Can we manage this error in coding and can delete the directoty.
As already indicated, you can't do that directly, or else use CloseHandle first to close the file and then delete it.