locked
How to get all the files in the Temporary Internet Files Folder? RRS feed

  • Question

  • HI All Thank you for reading.

    I am trying to do the sample code from this link: http://msdn.microsoft.com/en-us/library/t49t9ds1.aspx

    // enum_files.cpp
    // compile with: /clr
    using namespace System;
    using namespace System::IO;
    int main()
    {
       String^ folder = "C:\\";
       array<String^>^ dir = Directory::GetDirectories( folder );
       Console::WriteLine("--== Directories inside '{0}' ==--", folder);
       for (int i=0; i<dir->Length; i++)
          Console::WriteLine(dir[i]);
       array<String^>^ file = Directory::GetFiles( folder );
       Console::WriteLine("--== Files inside '{0}' ==--", folder);
       for (int i=0; i<file->Length; i++)
          Console::WriteLine(file[i]);
       return 0;
    }

    my test is like this:

    for each (String^ filePath in Directory::GetFiles(folder))
    					listBox1->Items->Add(filePath);

    But I am keep getting error about: hex constants must have at least one hex digit.

    I cannot think what is this error pointing about could someone show me some light.

    Thank you for your help, Appreciate.

    I have Visual C++ 2010 Express

    I have a Windows Form Application

    I got the Hex error resolved but I still cannot see any files get listed in the listBox1, Any point on that please. I have changed the Title accordingly. Thank you again.


    Edit=>>Sorry for the changes (Update) The Code works but one thing I notice is I cannot get file from the Temporary Internet File folder only the desktop.ini. What I need is all the Cookies and all other files in it. Got it. Thanks Anyway.
    • Edited by Xiong Wei, Jin Monday, January 6, 2014 6:20 PM Some Update (I have resolved)
    Monday, January 6, 2014 5:12 PM

Answers

  • The Code works but one thing I notice is I cannot get file from the Temporary Internet File folder only the desktop.ini. What I need is all the Cookies and all other files in it. Got it. Thanks Anyway.
    What path are you specifying?
    • Marked as answer by Xiong Wei, Jin Thursday, January 9, 2014 7:26 PM
    Monday, January 6, 2014 8:11 PM
  • Hi Xiong Wei,

    "one thing I notice is I cannot get file from the Temporary Internet File folder only the desktop.ini"

    Do you mean that the only file you can get from the Temporary Internet File folder is desktop.ini?

    Please check the path of your Temporary Internet File folder and ensure that the cookies and other files you want exist in that path.

    Best regards,

    Sunny

    • Marked as answer by Xiong Wei, Jin Thursday, January 9, 2014 7:26 PM
    Wednesday, January 8, 2014 6:55 AM
  • From what I know there is no simple access to the files in the temporary file folder of the InternetExplorer possible. I remember that I read somewhere that this is for system protection and security to make it more difficuilt for virus / tronjans ... to infect the system (at least in Win7 and above, maybe Vista also).

    Best regards

    Bordon

    Note: Posted code pieces may not have a good programming style and may not perfect. It is also possible that they do not work in all situations. Code pieces are only indended to explain something particualar.


    • Edited by Bordon Wednesday, January 8, 2014 9:48 AM
    • Marked as answer by Xiong Wei, Jin Thursday, January 9, 2014 7:26 PM
    Wednesday, January 8, 2014 9:47 AM

All replies

  • The Code works but one thing I notice is I cannot get file from the Temporary Internet File folder only the desktop.ini. What I need is all the Cookies and all other files in it. Got it. Thanks Anyway.
    What path are you specifying?
    • Marked as answer by Xiong Wei, Jin Thursday, January 9, 2014 7:26 PM
    Monday, January 6, 2014 8:11 PM
  • Hi Xiong Wei,

    "one thing I notice is I cannot get file from the Temporary Internet File folder only the desktop.ini"

    Do you mean that the only file you can get from the Temporary Internet File folder is desktop.ini?

    Please check the path of your Temporary Internet File folder and ensure that the cookies and other files you want exist in that path.

    Best regards,

    Sunny

    • Marked as answer by Xiong Wei, Jin Thursday, January 9, 2014 7:26 PM
    Wednesday, January 8, 2014 6:55 AM
  • From what I know there is no simple access to the files in the temporary file folder of the InternetExplorer possible. I remember that I read somewhere that this is for system protection and security to make it more difficuilt for virus / tronjans ... to infect the system (at least in Win7 and above, maybe Vista also).

    Best regards

    Bordon

    Note: Posted code pieces may not have a good programming style and may not perfect. It is also possible that they do not work in all situations. Code pieces are only indended to explain something particualar.


    • Edited by Bordon Wednesday, January 8, 2014 9:48 AM
    • Marked as answer by Xiong Wei, Jin Thursday, January 9, 2014 7:26 PM
    Wednesday, January 8, 2014 9:47 AM
  • Hi Brian/Sunny/Bordon

    Thanks for all the reply

    The mistake I made was C++ takes the string differently and I resolved it by reading article from this link

    2.4.4.5 String literals

    the back slash was causing the problem about hex. Reading again my post I feel kind of ambiguos the (Got it) It does not meant the rude way to you but meant (I got it, I understood now). Hope that didn't offend anyone.

    I changed to the Temp and the Cookies folders I will see how far I can get if any I be back, thank you all. Very much  appreciate.

    Thursday, January 9, 2014 7:26 PM