C# Shell32 - Error: The system cannot find the file specified.

Discussion in 'General Computer Support' started by cmedine, Jan 31, 2011.

  1. cmedine

    cmedine

    Joined:
    Jan 31, 2011
    Messages:
    1
    Hello,

    I am using Shell32 to unzip files, but am getting the famous vague error:
    The system cannot find the file specified. (Exception from HRESULT: 0x80070002). The error is thrown at the srcFlder declaration.

    Here is my code - Any help is appreciated:

    Code:
    DirectoryInfo di = new DirectoryInfo(@"C:\Test\");
                
                foreach (FileInfo fi in di.GetFiles("*.zip"))
                {
                    foreach (DirectoryInfo dir in destinationDir)
                    {                                     
                        String file = fi.ToString();
                        var destinationPath = @"C:\AppName\";
                        if (!Directory.Exists(destinationPath))
                            Directory.CreateDirectory(destinationPath);
    
                        Shell sh = new Shell();     
                        Folder destFlder = sh.NameSpace(destinationPath);
                        Folder srcFlder = sh.NameSpace(fi.FullName);
                        foreach (FolderItem F in srcFlder.Items()) 
                               { destFlder.CopyHere(F,null); }                                
    
                    }
                }
    cmedine, Jan 31, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?R0xGaWZlcg==?=

    Wireless cards can't be installed--"Cannot find file specified"

    =?Utf-8?B?R0xGaWZlcg==?=, Sep 10, 2005, in forum: Wireless Networking
    Replies:
    10
    Views:
    5,742
    =?Utf-8?B?R0xGaWZlcg==?=
    Sep 24, 2005
  2. strollingjj
    Replies:
    11
    Views:
    10,998
    Bucky Breeder
    Dec 3, 2006
  3. Toby

    cannot find the #@$%$##^& file specified...

    Toby, Oct 1, 2007, in forum: Computer Information
    Replies:
    1
    Views:
    503
  4. Jim Comfort

    "Setup cannot find the file specified (code 31) error"

    Jim Comfort, Dec 30, 2007, in forum: Wireless Networking
    Replies:
    5
    Views:
    502
    Jim Comfort
    Jan 4, 2008
  5. The Stone Crusher
    Replies:
    5
    Views:
    3,522
    Evan Platt
    Apr 5, 2009
Loading...

Share This Page