1

help me how to copy file from Temporary Internet Files on xp or higher. copyfile not is working on it.

i want to make it like CopyFileEx(scr, dst):boolean

mplungjan
  • 169,008
  • 28
  • 173
  • 236
XBasic3000
  • 3,418
  • 5
  • 46
  • 91
  • 5
    _is not working on it_ is not as good to wonder what is happening there.. consider adding the exact error message/exception you're getting and don't forget to include information about how you're copying the file (maybe a bit of code) – jachguate Jan 24 '11 at 05:14
  • Is it your temporary internet files, or a version owned by another user? I'm sure Windows protects users from reading other users internet cache. – David Heffernan Jan 24 '11 at 09:06

2 Answers2

3

I think you are using wrong path. this folder [Internet temporary files] has especial structure, to see this structure, try to search it with [faAnyFile] attribute like this:

procedure TForm2.Button2Click(Sender: TObject);
var
  path: Array[0..MAX_PATH] of Char;
  sRec: TSearchRec;
begin
  SHGetFolderPath(0, CSIDL_INTERNET_CACHE, 0,0, @path);
  if FindFirst(PATH+'\*.*', faAnyFile, sRec) = 0 then
    Begin
      repeat
        ListBox1.Items.Add(sRec.Name);
      until (FindNext(sRec) <> 0);
      FindClose(sRec);
    End;
end;

You will find some folders there like (Content.IE5, Content.MSO, AntiPhishing… ), under folder Content.IE5 you can also find sub-folders with random names like this:

<path>temporary internet files\content.ie5\randomfoldername

So,if you are looking for the cash files you can find it in these random sub-folders but you have to write search algorithm to search these folders for the file you want, and then you can copy it using its real path.

EDIT: also you can see the real structure of the [Internet temporary files] directory using the dir command from dos CMD like this: enter image description here

BTW: don't forget to use th Short Path Name in Dos.

Issam Ali
  • 1,703
  • 3
  • 15
  • 35
0

The best way to work with IE's cache is to use the WinInet API for that, in this case the GetUrlCacheEntryInfo/Ex() functions. Pass in the original URL, and it will return the exact local path to the cached file (amongst other things), which you can then copy as needed. Also have a look at the FindFirst/NextUrlCache...() functions for enumerating the contents of the cache.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770