I need to copy all images from Temperary Internet Files to some other directory. I tried using below code
string[] IeImageFiles = Directory.GetFiles(
Environment.GetFolderPath(Environment.SpecialFolder.InternetCache).ToString());
the problem is that GetFiles method returns only few files. Whereas I can see many files in the same folder when I browse through internet explorer 'View Files'(IE options -> General Tab -> Settings ->Temporary internet Files).
I need to know the physical path so as to query the directory and get the files. How to achieve that. Any help greatly appreciated.
The files you see when you do 'View Files' (IE options > General Tab > Settings > Temporary internet Files) are not actually files that are located on disc directly in the Temporary Internet Files
folder.
There's a hidden folder inside that location called Content.IE5
, and that will contain several randomly named folders with the actual temporary internet files inside them.
To get a list of them you can do this:
var path = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.InternetCache),
"Content.IE5");
string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
For more information check out A Primer on Temporary Internet Files by Eric Law.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With