locked
got exception when creating directory on Storage card RRS feed

  • Question

  • hi there,

    when i try to create directory on storage card, i got ArgumentException , someone knows what's the problem? that's the code:

    ...

    directory.CreateSubdirectory(@"\Storage Card\Notes");

    ...

    Thanks,

    Stephen


    stephen88
    Wednesday, September 22, 2010 3:49 PM

Answers

  • i find the way, just use Directory.CreateDirectory(...), then whatever path u put in, it will create.

    Thanks for help.


    stephen88
    • Marked as answer by stephen88 Thursday, September 23, 2010 1:02 AM
    Thursday, September 23, 2010 1:02 AM

All replies

  •  

    Hi ,

    Please  use  given below code for yours specific requirement .

    private void CreateFolder(string parentPath, string folder) { try
        {
            string path = parentPath + @"\" + folder;
            if (!File.Exists(path))
            {
                DirectoryInfo dir = new DirectoryInfo(parentPath);
                dir.CreateSubdirectory(folder);

            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

    Regards,

    Ashakant

     

    Wednesday, September 22, 2010 5:07 PM
  • i had those check, the problem is that it seems 'CreateSubdirectory' does not apply to Storage Card\Note directory, even in file explore, i see the 'Storage Card' there.  Thx.


    stephen88
    Wednesday, September 22, 2010 5:48 PM
  • i find the way, just use Directory.CreateDirectory(...), then whatever path u put in, it will create.

    Thanks for help.


    stephen88
    • Marked as answer by stephen88 Thursday, September 23, 2010 1:02 AM
    Thursday, September 23, 2010 1:02 AM