public static FileStream Create(string path) { if (Directory.Exists(path)) { // if folder not exist if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } } if (!File.Exists(path)) { return File.Create(path); } return null; }