0

My server OS is Windows Server 2003. I have few folders that no matter what I try to delete, it just wont be deleted. The error message is "File sharing violation" or "being used by other person or program". Nobody is using that folder, and there is no any program that use it. But, why still i cant removed? Anyone can help?

(i tried deleted in command prompt as well, but still failed)

(The last option I would do is restart my server, but I really hope not to use this option, cuz I got a lot of reasons not to restart the only big server)

2

9 Answers 9

4

Look at this How do you find what process is holding a file open in Windows?

You should be able to find what is holding your file.

Sysinternals Process Explorer
Unlocker

2

I use WhoLockMe to discover what's holding on to the folder.

3
  • is it safe to put it on server? My server is very important.. If its a virus, I will be damn dead..
    – mcfadder_09
    Jun 18, 2009 at 8:07
  • I've never had any problems with it on any of the servers I've installed it on, and it's definitely not a virus.
    – RainyRat
    Jun 18, 2009 at 8:12
  • thanks, I will give it a try later on. Hope it could solved my problems..
    – mcfadder_09
    Jun 18, 2009 at 8:16
1

Get Process Explorer (which you should already have, actually), hit Find → Find Handle or DLL (or Ctrl+F) and type in the file/folder name you are trying to delete. Most probably you will get a list of processes that have your file/folder opened (look for type 'Handle'). Before a file/folder can be deleted you need to close any process listed there. Sometimes you will get nothing, but still won't be able to delete the file. Restarting the server might be the fastest option.

1

A program called "Unlocker" is a good match. It is small and free, and all you have to do is install it, then (if you enabled it in the installation options) right click on the folder and click unlock.

It will give you a list of processes that are using it, and give you options. You can unlock it, or just tell unlocker to delete/move/etc. the file.

0

Sory, I know this question is not programming related. I have post this question in serverfault.com. I try to delete this post, but I dun have the privilege to do it. So, whoever can delete this post, just delete it.. Cuz i have post it in here:

http://serverfault.com/questions/27853/how-to-removed-server-file-folder

0

Use Sysinternals (now a part of Microsoft) Process Explorer. Find menu, Find Handle or DLL and then enter a string to search for. Will show you the process that is holding the file open. If the process is "System", check Computer Management, System Tools, Shared Folders, Open Files to see if it is locked by a remote user.

Process Explorer

0

Right click on My Computer, select manage. Expand Shared Folders and select Open Files. This will show you all users who have a file open or any locks. You can then find the file/folder on the list, right click and drop the lock.

0

I had a similar problem, and even though my admin account should have had sufficient rights, I wasn't able to clear out the old files until I changed/took ownership (properties, security, advanced, owner). The error message didn't imply anything of the sort, but it worked!

0

Look for an application that lists your currently open files and by what process (a "lsof" for windows if you will)

Once you find the process that's holding the file open you can kill it and try to delete the file again.

Rebooting might not help since the process that holds the file open could be restarted. If the process is important (say, an application server) you might as well just schedule some down time or come in after/before work.

You must log in to answer this question.