"Daryl" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi,
>
> When I try to delete a large file such as a video mpg file (it doesn't
> appear to happen with small files), I appear to have successfully
> deleted the files but, when I look at the containing folder in
> explorer - the file appears to still be there!
>
> If I then try to delete it again - it gives me an error message so it
> would appear that the file has actually gone. However, the disk space
> if not freed up.
>
> Upon reboot, the file has gone but how can I prevent this behaviour -
> I know it's not by default as this does not happen on my laptop.
>
> My hard drive is an NTFS disk.
Probably because explorer.exe itself (which is also used for the GUI
desktop) has a handle on it, like to show you the preview picture when
that file was selected. To check if Explorer is holding onto the file:
- Open Task Manager.
- Kill all instances of explorer.exe. The desktop disappears.
- Use File -> New Task to run "cmd.exe".
- In the DOS shell, check if the file still exists; if so, delete it.
- Use File -> New Task to run "explorer.exe". The desktop reappears.
One side-effect of this approach (of unloading explorer.exe to delete
files that it has inuse) is that programs that don't periodically update
their tray icons will not show up in the system notification area (aka
tray area) until you logoff and login. Rebooting will release the file
handle because explorer.exe gets shutdown and the file handle object
gets obliterated and why you can delete the file after the reboot or it
disappears because the pending delete completed. The method above
eliminates the need to reboot if explorer.exe is the culprit holding
onto the file.
You might also want to use utilities to see if a process has an open
handle on the problematic file. Use 'handle' from SysInternals (bought
by Microsoft) or 'oh' from the Resource Kit. You could also try the
Unlocker utility (
http://ccollomb.free.fr/unlocker/).