public static void CreateDirectory(string par, string name, bool trial = true) { if (par == null) { par = RegistryAccess.CodesPath; } int tcount = 1; string path = Path.Combine(par, name); while (trial && Directory.Exists(path)) { path = Path.Combine(par, string.Format("{0} ({1})", name, tcount)); ++tcount; } LocalDirectory.CreateDirectory(path); }