3 ms·
will it delete files even if open in another process? this is my main bugbear with windows file deletion: it won't delete it and you need special tools to track
by ptah 7y ago
will it delete files even if open in another process? this is my main bugbear with windows file deletion: it won't delete it and you need special tools to track down the process that has the file open
- apankrat 7y agoDepends on how they are opened. If they aren't opened in FILE_SHARE_DELETE mode, then they will in fact be locked against deletion... because that's exactly what file's current user wanted. Force-deleting a file in this case is not the wisest thing to do. [1] https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea#parameters https://docs.microsoft.com/en-us/windows/win32/api/fileapi/n..., Ctrl-F for FILE_SHARE_DELETE
- pjmlp 7y agoWhich is the right thing to do and the approach taken in all non-UNIX clones. In any case, since ages one does not need special tools, resource monitor listing of open handles is enough.
- BubRoss 7y agoIt's the right thing to give an error that some process has the file open but never tell you which process that is?
- pjmlp 7y agoIt might not be the most user-friendly way, but sure tops removing the file altogether.
- latitude 7y agoThat’s an UI issue with the tool. The underlying behavior is correct though - people with open handles have the priority unless they have explicitly stated that deleting a file while they use it is OK.
- BubRoss 7y agoWhat tool? That's windows' behavior. I would agree that locking a file and preventing deletion is good or possibly queueing a file for deletion when it is free, but windows does not handle this scenario well.
- Ididntdothis 7y agoTelling you what process has a folder or file open should be added to windows explorer. It’s hard to explain why it isn’t.
- SAI_Peregrinus 7y agoA workaround to this is to use Process Explorer[1] to search for the filename, then kill the process that has a handle with that file name. [1] https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer https://docs.microsoft.com/en-us/sysinternals/downloads/proc...