以编程方式复制文件从“Internet临时文件”到其他目录临时文件、方式、文件、目录

2023-09-04 00:33:06 作者:女王陛下

我需要从Temperary Internet Files文件的所有影像复制到其他目录。我试着用下面code

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());

问题是,GetFiles的方法,只返回一些文件。虽然我可以看到很多文件在同一文件夹时,我通过Internet Explorer查看文件浏览(IE选项 - >常规选项卡 - >设置 - > Internet临时文件)。

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).

我需要知道的物理路径,以便查询目录并获得文件。如何实现这一目标。任何帮助非常AP preciated。

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.

推荐答案

你看当你这样做查看文件(IE选项>常规选项卡>设置> Internet临时文件),该文件是位于光盘不实际的文件直接在 Internet临时文件文件夹。

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.

还有里面那个位置叫做 Content.IE5 一个隐藏文件夹,将包含在他们里面的几个实际Internet临时文件随机命名的文件夹。

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);

有关详细信息,请查看A底漆上Temporary Internet Files文件由Eric法的。

For more information check out A Primer on Temporary Internet Files by Eric Law.