以编程方式复制文件从“Internet临时文件”到其他目录 [英] Programmatically Copy Files from 'Temporary Internet Files' into other directory

查看:165
本文介绍了以编程方式复制文件从“Internet临时文件”到其他目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从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);

有关详细信息,请查看<一个href="http://blogs.msdn.com/b/ieinternals/archive/2011/03/19/wininet-temporary-internet-files-cache-and-explorer-folder-view.aspx">A底漆上Temporary Internet Files文件由Eric法的。

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

这篇关于以编程方式复制文件从“Internet临时文件”到其他目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆