Fog Creek Software
Discussion Board




Windows File System

Why is it that when I try to delete a folder I keep getting the message "Can´t delete somefolder:  It is being used by another person or program" even though no program should be using it? Like just now, I moved a file from a folder to the desktop and then tried to delete the folder. I keep getting this message, and now it´s been at least 5 minutes since I moved the file.  Is there some problem with the OS holding a lock on the folder for a long time after it´s finished the operation? It´s incredibly annoying! This is NTFS on Windows XP.

</rant>

mr. X
Tuesday, June 22, 2004

yep, I have the same problem only I have some files that have been "open" for a month or more, despite several reboots of both the fileserver and the workstation, sometimes simultaneous reboots.

muppet is now from madebymonkeys.net
Tuesday, June 22, 2004

Everybody working on Windows should know about the SysInternals tools RegMon, FileMon and ProcExp...

"Ever wondered which program has a particular file or directory open? ... Process Explorer shows you information about which handles and DLLs processes have opened or loaded."
http://www.sysinternals.com/ntw2k/freeware/procexp.shtml

Duncan Smart
Tuesday, June 22, 2004

or maybe the file system should like, you know, work.

I have one server and one workstation on my LAN most times.  If I shut them both off, fire them up, and then connect to a network share from the workstation, none of the media files in that share should be "open" and undeletable.

muppet is now from madebymonkeys.net
Tuesday, June 22, 2004


It's not the file system.  It's Windows Explorer creating thumbnail images and other bizzare crap, then holding these files open and refusing to delete them.

You ought to be able to delete these files and folders using the command line.

There's a long discussion in a previous thread.

Craig
Tuesday, June 22, 2004

"or maybe the file system should like, you know, work" - it works just fine. If your machine is littered with spyware and viruses, the file system is doing what it should and maintaining locks for them while they scour your system.

Bummers are deaf
Tuesday, June 22, 2004

Hey good tip about Process Explorer, thanks.

Brad
Tuesday, June 22, 2004

*Bummers are deaf *

I scour my machine about twice weekly with Spybot S&D, Adaware, and Norton Antivirus.  (I do sanity checks at pc-cillin on occasion, too)

I also pretty much never install absolutely ANYTHING that isn't open source or hasn't got a clean reputation.  My machine is probably one of the most immaculate installs of Windows out there.

Maybe you should quit flaming and come up with an opinion you can back up with something other than noise.

muppet is now from madebymonkeys.net
Tuesday, June 22, 2004

The filesystem works.  Besides, this isn't a filesystem issue.

If you can't delete it, some process on your system has locked the file.  Windows doesn't magically lock files on it's own.  An executing program has to have locked it.  When that process ends, so does the lock.

Now, it's possible the culprit is Windows Explorer.  If Exporer gets a lock and won't let go, then it can appear that the file has been "locked for months" because Explorer has been running for months.

If you have something like file preview or thumbnails turned on, Explorer can hold a lock for a pretty long time on large files (like movies) because it taks a long time to generate the preview/thumbnail.

If you run Process Explorer from Sysinternals, you can see what's locked on your system, and who locked it.  I beleive there's another utility floating around that does something similar (WhoLockMe?), but I really like Process Explorer.  It's become my replacement for the Task Manager.

Myron A. Semack
Tuesday, June 22, 2004

Oh, you have Norton Antivirus...

It could be that too.  I've seen versions of NAV that we a little "greedy" about locking files when real-time filesystem protection is enabled.  I don't know if this has ben corrected in newer versions.

Either way, Process Explorer should be able to report it.

Myron A. Semack
Tuesday, June 22, 2004

Dude.  If I kill power to the machine, power it back up, and then go in and try to delete the file, it's still open.

I don't have thumbnails or anything else like that turned on in this directory.  It's not trying to thumbnail anything.

Even on a machine where the only running process is explorer (and various system services, of course), the file remains locked.  I find it truly hard to believe that explorer itself has been holding onto this file for months, surviving several reboots.  Something is up.

In any case I'll go find this processexplorer, I suppose.

muppet is now from madebymonkeys.net
Tuesday, June 22, 2004

for what you want you want handle.exe, not procexp. but get them both while you're there.

mb
Tuesday, June 22, 2004

Please let us know what the culprit was.

DJ
Tuesday, June 22, 2004

"I find it truly hard to believe that explorer itself has been holding onto this file for months, surviving several reboots.  Something is up."

Ahhhhhh, boy, *that* brings back memories... everyone remember the first time you thought this? ...

Grumpy Old-Timer
Tuesday, June 22, 2004


The problem is not that explorer is 'holding the file for months'.  It is a bug in explorer that misinterprets its own thumbnail crap as outstanding locks on the file. 

I have had this problem.  When I opened a command line and deleted the files the old fashioned way, they were NOT locked.    That's why it is NOT the file sytem, but explorer that is at fault.

Craig
Tuesday, June 22, 2004

try renaming before delete. Sometimes files which explorer says are locked can be renamed. And then deleted.

And as someone else said, use the command line.

Tapiwa
Tuesday, June 22, 2004

for any reasonable windows user, Explorer IS the filesystem

:P

muppet is now from madebymonkeys.net
Tuesday, June 22, 2004

"because Explorer has been running for months."

giving Windows stability WAAAAYYYYYYY to much credit.

unsafe at any speed
Tuesday, June 22, 2004

Boot into Safe Mode. Drop into a command prompt. Delete the file. Reboot into Normal Mode.

KayJay
Tuesday, June 22, 2004

Mr. X. - are you doing .NET development?  Is it possible that a GC cycle hasn't happened yet, and you have an object that is holding onto that folder?

Chip H.

Chip H.
Tuesday, June 22, 2004

Make sure you've turned off the web content in folders view, and your folders are being displayed in 'Classic Windows mode'.

Explorer has to open the files to display the preview icon and other information in the sidebar.

A related problem I once had:
Open a folder with the sidebar showing. Click on 800 MB zip file. Explorer tries to open the file to display its info in the sidebar. Antivirus software says to Explorer, "Stop! Hands Off! I need to scan it first." Result: Explorer hangs for 1/2 hour while the AV software unpacks and scans the file.

A.T.
Wednesday, June 23, 2004

*  Recent Topics

*  Fog Creek Home