private void Createhtml(string sPath, string txt) { string currPath = @"C:\MyCodeHelper" + sPath; FileInfo fi = new FileInfo(currPath); var di = fi.Directory; if (!di.Exists) di.Create(); using (StreamWriter s = File.CreateText(currPath)) { s.Write(txt); } }