0

I'm having trouble creating a directory that is supposed to be located in a user's documents file.

Code

: string pathString = System.IO.Path.Combine("%UserProfile%\\Documents", "MyDir"); System.IO.Directory.CreateDirectory(pathString);

Once this is run it doesn't create anything at all. I'm not sure exactly what I'm doing wrong here, I've also tried inputting the string manually with no luck.

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
  • https://stackoverflow.com/questions/9993561/c-sharp-open-file-path-starting-with-userprofile – Retired Ninja Sep 23 '20 at 00:28
  • 1
    The following code works, I made two changes but I think my problem was that I was forgetting to put the ending \ on my directory System.IO.Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\MyDir\"); – Cyandra Sep 23 '20 at 00:49

0 Answers0