Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
296 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...