Batch file can't delete a file "that's in use" but the file doesn't seem to exist?
Batch file can't delete a file “that's in use” but the file doesn't seem to exist?
counters.dat
is visible for me:
C:\Users\DavidPostill\AppData\Local\Microsoft\Windows\Temporary Internet Files>dir /a
Volume in drive C has no label.
Volume Serial Number is C8D0-DF1E
Directory of C:\Users\DavidPostill\AppData\Local\Microsoft\Windows\Temporary Internet Files
10/06/2015 21:29 <DIR> .
10/06/2015 21:29 <DIR> ..
08/01/2015 23:31 <DIR> AntiPhishing
11/01/2015 08:28 <DIR> Content.IE5
04/01/2015 16:50 128 counters.dat
10/06/2015 21:29 84 desktop.ini
10/02/2015 12:03 <DIR> gegl-0.2
05/02/2015 23:44 <DIR> inkscape
08/01/2015 23:31 <DIR> Low
29/05/2015 12:16 <DIR> SQM
03/01/2015 17:11 <DIR> Virtualized
2 File(s) 212 bytes
9 Dir(s) 83,685,535,744 bytes free
It cannot be deleted:
C:\Users\DavidPostill\AppData\Local\Microsoft\Windows\Temporary Internet Files>del counters.dat
C:\Users\DavidPostill\AppData\Local\Microsoft\Windows\Temporary Internet Files\counters.dat
The process cannot access the file because it is being used by another process.
C:\Users\DavidPostill\AppData\Local\Microsoft\Windows\Temporary Internet Files>
Using resmon
we can see which processes are using the file:
You won't be able to delete counters.dat
while any processes have it open.
"Why does a dir show 1 file and N directories, but when I browse to this location in Windows Explorer I see 0 directories and 83 files?"
Windows 7 and 8 create Virtual Folders to store files that Internet Explorer tries to save in protected locations.
The data is actually written in a virtualized hidden folder, that mirrors the actual path and is stored under the Temporary Internet Files
folder.
It seems that explorer
and dir
treat virtual folders differently in how they are displayed.
Cygwin ls
can at least display the contents of Content.IE5 which dir
cannot.
DavidPostill@Hal /c/Users/DavidPostill/AppData/Local/Microsoft/Windows/Temporary Internet Files
$ ls -al Content.IE5
total 692
drwxrwx---+ 1 DavidPostill None 0 Jan 11 07:28 .
drwxrwx---+ 1 DavidPostill None 0 Jun 10 21:29 ..
drwxrwx---+ 1 Administrators None 0 Jun 11 13:07 4EIQY12G
drwxrwx---+ 1 DavidPostill None 0 Jan 8 22:31 969NZU3P
drwxrwx---+ 1 Administrators None 0 Jan 10 23:18 97RLMZJM
drwxrwx---+ 1 DavidPostill None 0 Jan 8 22:31 ARML5AYH
-rwxrwx---+ 1 Administrators None 0 Jan 4 15:50 container.dat
drwxrwx---+ 1 Administrators None 0 Jun 11 13:23 DO6HI19N
drwxrwx---+ 1 Administrators None 0 Jan 9 23:28 FQECM0IG
drwxrwx---+ 1 DavidPostill None 0 Jan 8 22:31 HY66GH4K
drwxrwx---+ 1 DavidPostill None 0 Jan 8 22:31 IM8A2PXZ
drwxrwx---+ 1 Administrators None 0 Jun 11 13:07 KHCCNELO
drwxrwx---+ 1 Administrators None 0 Jan 9 23:28 MAX18LP0
drwxrwx---+ 1 Administrators None 0 Jun 11 13:08 OJ3O062M
drwxrwx---+ 1 Administrators None 0 Jan 9 23:28 YTDLISE8
Windows 7 | 8 also creates Virtual Folders to store files that Internet Explorer tries to save in protected locations. So, instead of causing an ‘add-on’ to fail when it tries to write a data file to the Windows folder or Program Files, Windows 7 or Vista redirects the write operation to a virtual equivalent. Thus, the program continues to operate, believing that it wrote the files to the system location; little realizing that the data actually got written in a virtualized hidden folder, that mirrors the actual path and is stored under the ‘Temporary Internet Files’ folder.
Source Temporary Internet Files Folder Location
Related videos on Youtube
Comments
-
sab669 over 1 year
I have this simple batch script:
cd "C:\Users\me\AppData\Local\Microsoft\Windows\Temporary Internet Files" del *.* /f /q pause
When I run it, it tells me that it cannot delete
\Temporary Internet Files\counters.dat
because it's in use and quits. I am able to manually delete all of the contents of the folder myself though, without changing anything in regards to what applications are running. Also, I do have Hidden Files/Folders set to show up and I don't even see a counters.dat file... Has anyone encountered this?-
MaQleod almost 9 yearsMaybe its hidden? I found this relating to that file: symantec.com/security_response/…
-
-
sab669 almost 9 yearsInteresting catch there. Why does a
dir
show 1 file and N directories, but when I browse to this location in Windows Explorer I see 0 directories and 83 files? -
sab669 almost 9 yearsOh, I didn't see you edited your post. I'm tied up working on something else right now, but thank you so much! I will be sure to come back an Accept it when I can take a look.