We help IT Professionals succeed at work.

Can't delete files, OS (2008) says they're still open even after restart

usslindstrom
usslindstrom used Ask the Experts™
on
Experts,

I've stumbled accross a strange issue with some files that I need to get rid of.

When I attempt to delete them from GUI, Windows says that they're all in use and won't let me delete them (There are about 10 files total).

I've read forums on stopping the explorer service, which I've done - as well as restarting the server in question.  Unfortunately, those files are still being pretty stubborn and won't let me just get rid of them.

In the code block below, you can see the output of "net share" and "net file" showing that they' don't have any active sessions, but you can also see what happens in the screenshow when I try and delete it.

Is there a manual way to reset the "lock" flag on files such as this?

 NoDelete
C:\>net share

Share name   Resource                        Remark

-------------------------------------------------------------------------------
ADMIN$       C:\Windows                      Remote Admin
C$           C:\                             Default share
F$           F:\                             Default share
G$           G:\                             Default share
IPC$                                         Remote IPC
The command completed successfully.




C:\>net file
There are no entries in the list.

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Restart your computer in safe mode and delete the app.

Commented:
sorry I mean delete the files.. ( not app ) in safe mode.

Author

Commented:
Thanks for the suggestion - but unfortunately they're still "undeletable".

Booted to safe mode and still getting the error that they're "open in another program".

Author

Commented:
*On a side note, it does let me rename the files.

If they were actually "in use" - it would've errored out when I attempted to rename.
You can use Handle to check which program/process is using the file:
http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx
there is a free app called unlocker, this locates all processes, applications or threads that may be holding the file, thereafter it may be unlocked and moved / deleted, however when i file is in use it normally has a good reason, in this case i am assuming it is a temporary internet page.

http://download.cnet.com/Unlocker/3000-2248_4-10493998.html - unlocker link
description:
Ever had such an annoying message given by Windows: Cannot delete file: Access is denied. There has been a sharing violation. The source or destination file may be in use or the file is in use by another program or user. Make sure the disk is not full or write-protected and that the file is not currently in use. Unlocker is the solution. Unlocker is an Explorer extension that allows you with a simple right-click of the mouse on a file or folder to get rid of error message such as error deleting file or folder, cannot delete folder: it is used by another person or program.


Author

Commented:
Thanks for the suggestion guys.

uvals:  Booting into Safe Mode wasn't able to remove the files, but while the unit was down is when I started some more in depth troubleshooting.

GertLievens:  That Handle app is very informative.  It didn't report on which process had the particular files I needed to nuke on it, but I will be using that in the future, as it absolutely reports on a ton of information that's not built directly into the OS.

Confucious2:  Your solution would be perfect, however, I'm not at liberty to install software on any of the servers.  I'll keep that in mind on the next time I will need to nuke items from local workstations.

The solution that worked in this particular case, was that no matter what I tried - I couldn't remove the 10 files that the OS had a lock on.  These files were on an internal drive, completely separate from anything the OS needed to use...

So, I moved the required files that needed to be kept off of the drive - and formatted it.  Windows flashed a warning that other processes had control of the files (still didn't say which ones) and asked for confirmation on deleting them.  I gladdly acknowledged, and poof - problem files were dropped in the format.

I moved the needed files back over to the drive in question, and we're back up and running.

Sure wish that confirmation box appeared on just deleting.