§ ¶AVI files that won't go away
Ever had an AVI file that you couldn't delete, because every time you tried, you got an Access Denied or "file is already in use" error?
In Windows, it's not normally possible for a file to be locked by an application after that app exits, and very not possible for the app to have the file locked after the system has rebooted. Nine times out of ten this is caused by the Windows XP Shell Media Extension (shmedia.dll), which provides statistics and thumbnails for media files. Problem is, sometimes shmedia gets stuck on a file, and since it runs inside of Explorer, that file is effectively locked until you restart or logoff. And even that doesn't help, because after restarting, opening the folder causes it to lock the file again. Using Process Explorer from sysinternals.com is the easiest way to confirm that Explorer is holding the file open.
Deleting the file via the command-line, rather than navigating to the folder in Explorer, should work. If you're not a fan of the command-line and don't DEL the file that way, an alternative solution is to temporarily unregister shmedia.dll (regsvr32 /u shmedia.dll), restart, delete the file, and then re-register the extension (regsvr32 shmedia.dll). This is cleaner than hacking the registry to blow away the extension. I always just leave it unregistered, though, because I don't need it.
Note that there is a bad bug in older versions of VirtualDub's frameclient that can exacerbate this problem and cause it to happen for all AVI files, not just broken ones. It only happens if you have manually installed the AVIFile frameclient using auxsetup.exe and also enabled proxy mode via the proxyon.reg file; it doesn't happen if you just use VirtualDub itself, so most people won't run into this. Uninstalling the frameclient or turning off proxy mode are sufficient to fix the problem. This bug was fixed a while ago in version 1.6.0, so if you use proxy mode and are experiencing this problem, installing the frameclient from a newer version is sufficient.
A slightly different problem that can occur is when the AVI file can't be found, but it still seems to be taking space. One culprit of this is a damaged FAT32 filesystem, if you are using an older system and had a system failure while writing an AVI file. Usually the damage is relatively harmless, just some clusters lost in an orphaned chain. Normally Scandisk or Chkdsk will catch this on the restart, but if by chance it doesn't, running a manual check will fix up the drive. The other common cause is Norton Protected Recycle Bin, which squirrels the deleted AVI file into a different Recycle Bin that most people miss, and has a habit of accumulating an ungodly amount of files. Just flush Norton (or its Protected Recycle Bin) and you'll get your space back.
Comments
Comments posted:
So that is why my AVI files are locked after creation in VirtualDub... Very interesting on the FAT32 filesystem bit... Although, FAT32 tends to break files and still keep them listed as "good" files... Usually AVIs, OGMs, WMVs, etc. are usually subject to this... ISO files are also affected but rarely...
Pharaoh_Atem (link) - 19 02 06 - 15:41
This made me remember something - is virtualdub closing/releasing avisynth scripts properly when starting processing from job control? For example:
1. Start virtualdub and open a script that has something like avisource("video.avi")
2. Open job control (with unrelated jobs already queued) and hit start.
3. Try and delete video.avi and it appears to be locked. Process explorer shows virtualdub still has a handle for it.
squid - 19 02 06 - 21:51
Just tried AVISource() with Avisynth 2.55 and a couple of other jobs in the job list and couldn't reproduce the handle leak. If you're still having this problem, please followup on forums or by email with the script in question and I'll try digging into it.
phaeron - 20 02 06 - 01:32
Unregistering shmedia.dll used to work for me, except that every once in a while (probably because of some update) it was re-registered. However, now it doesn't work anymore at all on one of my windows boxes. Running "regsvr32 /u shmedia.dll" and rebooting has no effect. Explorer keeps "previewing" all avi files (and driving me mad), so either shmedia.dll doesn't get properly unregistered or there is some other way for Explorer to do its preview nastiness.
marcus - 20 02 06 - 12:14
The inability to delete -- and therefor to move -- a video file can easily be observed if the status bar at the bottom of the Explorer window is turned on. Because of the already in this article discussed problems it sometimes takes a long time to get the video information displayed. If you just be patient and wait for the information to be displayed you are not constrained anymore and are able to delete or move the file at will.
badjob - 20 02 06 - 18:11
About two years ago i guess, i don't remeber exactly, I ran in to this app
Windows XP AVI Fix 1.01 and I got to say that after using it I never had the problem again.
nick - 20 02 06 - 18:12
Here's what I do when I want to delete or move an AVI file that is "locked" by the Shell Media thing.
1) Close all Windows Explorer windows.
2) Open VirtualDub (or any program that has an "open" command)
3) Go to File --> "Open video file..."
4) Navigate to where the "stuck" avi file is
5) Delete the file
No need to reboot the whole comp.
Jack - 22 02 06 - 20:35
Another solution to this problem is a bit of freeware called Unlocker (
http://ccollomb.free.fr/unlocker/), a cool little shell accessory that will forcibly release these locks. I'd rate it as 95%-effective (been using it for a year or so)
It's a helluva lot more convenient than uninstalling a Windows Media DLL....
Jetman - 23 02 06 - 09:17
***marcus*** I always used to delete HKLMSystemFileAssociations.avishellexPropertyHandler "Default" registry key and it always worked fine. But couple of weeks ago I started to get "Access denied" messages and the problem was even worse then before. If before I could wait a little and delete the file after that, now I was getting "Access denied" no matter how long I waited. Deleting from command shell didn't work either. Unlocking utilities didn't work. Process Explorer could not tell me anything either. The only sure way was to reboot the system. And after I'd do that I'd find that Windows would already delete the file for me.
Sifting through registry I found the culprit: it was a registry key called "Video Thumbnail Extractor" which has a CLSID of c5a40261-cd64-4ccf-84cb-c394da41d590. I searched all instances of this key related to .avi handling (do 2 searches one with CLSID and second time with the name) and deleted those key.
Rebooted my machine and it worked!
Partizan - 24 02 06 - 11:34
Don't now if this matches exactly the descripted problem... I simply drag (without drop) a file if i wish to have it not previewed (in win2k). Works also for unlocking files.
I always have problems seldomly deleting files with broken downloads in firefox.
Nina - 25 02 06 - 16:52
Heres how I remove 'locked' avi files without restarting the computer:
-open the task manager (Ctrl-Shift-Esc)
-in the processes tab navigate to 'explorer.exe' and end process
-open a command prompt (File>New Task and type cmd or command)
-navigate in command prompt to locked files and delete
-restart explorer when finished (File>New Task and type explorer)
works everytime.
I use WinXP but I am sure this will work in W2k as well.
slush - 28 02 06 - 19:40
Hi there
I have a slightly different problem. If I open explorer and go to a directory that has avi files in it, my computer stops responding. I can move the mouse around but apart from that, nothing. I have to CTRL-ALT-Del and kill the explorer process. I've checked for viruses, trojans, malware. All is okay. This is becomiong very frustrating. I can open the avi files in Windows Media player and Virtuadub.
Anyone have a clue as to what is wrong?
johnd - 07 03 06 - 04:52
Thanks for the advice. I hadan AVI file (don't know where it came from tobe honest) and opening it, hovering over it, trying to right click on it all resulted in Explorer closing down.
To get rid of it, I opened Word, when to Open and to display all file types, selected the AVI file and deleted it. It was the only way to get rid of it but thank god its gone now.
SquirrelL - 06 01 09 - 09:10
Or get FreeCommander (a freeware "explorer"). Close Windows Explorer, run FreeCommander and delete the files with it.
denmark40 - 08 06 09 - 08:54
Logging off as opposed to restarting the computer, is a quicker way of dealing with share file violations, though it may not always work, it should work more often than not.
Brian (link) - 20 05 12 - 01:03
I have problems with Audiobooks, when loading them into my ZAP-player. I have severeral books converted from CD-format to MP3. These books cannot be played in a logical seccuens. I´ve looked all over the place to get a proper manuel for my two "ZAP SR300" with no result. Can You please help me with my problems?
Bengt Johansson - 14 02 13 - 11:01