I've had success with Sysinternals Process Explorer. With this, you can search to find what process(es) have a file open, and you can use it to close the handle(s) if you want. Of course, it is safer to close the whole process. Exercise caution and judgement.
To find a specific file, use the menu option Find->Find Handle or DLL...
Type in part of the path to the file. The list of processes will appear below.
If you prefer command line, Sysinternals suite includes command line tool Handle, that lists open handles.
Examples
c:\Program Files\SysinternalsSuite>handle.exe |findstr /i "e:\"
(finds all files opened from drive e:\
"
c:\Program Files\SysinternalsSuite>handle.exe |findstr /i "file-or-path-in-question"
As far as I can tell, these is no "official" Microsoft supported way of doing this. There are two options. One involves deleting c:\$Recycle.Bin and the other is scripting cleanmgr.exe to run at each user logon.
The closest thing to "official" support for deleting c:\$Recycle.bin is from this MS KB, which references XP and Vista, but implies the expected behavior.
Immediate deletion
If you want this to happen immediately, it seems that you can just run rd /s c:\$Recycle.Bin
and Windows should re-create the necessary folders the next time that they are needed. I just tested this quickly and it appears to work, but -obviously- proceed with caution.
Recurring logon-scriptable deletion
You can do this with the Disk Cleanup tool (cleanmgr.exe). Unfortunately, Microsoft decided to bundle this with the "Desktop Experience" set of features, meaning you'll have to install a bunch of other crap and reboot.
The alternative is to grab the following two files and move them to the specified locations per Technet:
C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe
C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui
Cleanmgr.exe should go in %systemroot%\System32.
Cleanmgr.exe.mui should go in %systemroot%\System32\en-US.
Running cleanmgr alone won't let you clear everyone's recycle bin, but you can use /sageset and /sagerun to make a logon script that runs for all users via GPO that will clear their recycle bin on the next logon, as described here. It's not the cleanest thing, but it will work. The linked article is for XP, but the syntax is unchanged as of Server 2008 R2.
Best Answer
In
C:\$RECYCLE.BIN\S-1-5-21-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx-xxxx\
the files aren't copies of the deleted files. Instead, they are files containing enough information for restoring the file.Deleted file
In this example a file
C:\Users\Public\Documents\test.txt
containing short plain text is deleted. Now, in$RECYCLE.BIN\<SID>
we have a file$IWRIFSD.txt
containing:The filename is a hash based on the metadata and the contents of this file are:
00
spaces).Therefore, you probably need either to log in as the user or use some 3rd party recovery tool.
Deleted folder
With deleted folders the recovery isn't that tricky. With similar test file inside a folder,
test\test.txt
:Only the folder name gets "jumbled" i.e. replaced with the hash of the metadata, but the names and contents of files seems to be intact.