Possible Duplicate:
C# - FileStream and creating folders
I have an input directory where XML files are FTP, there is an app that runs and then ingests all these XML and processes them. At the end, the file is moved to a folder that is created for the date it was processed on inside another directory. Here is the path I attempt to create:
D:\srv\test\ftp\Processed\07-19-2012
Here is the code that creates directories:
public static bool IfExistOrCreateDirectory(string path, bool createDirIfMissing) {
if (Directory.Exists(path)) return true;
else if (createDirIfMissing) {
try {
(new FileInfo(@path)).Directory.Create();
return true;
}
catch (Exception ex) { return false; }
}
else return false;
}
After this code runs it throws no exceptions and returns true. However, when I check the folder the folder named "07-19-2012" does not exist.
Thanks in advance.
PS- this code was working fine until I copied some XML files down from a server into the input folder to test. I can no longer create directories in any drive through code; it is as if they get created virtually.