private static string GetFolderName(string path) { Regex r = new Regex(@"\\\w+"); MatchCollection mc = r.Matches(path); return mc[mc.Count - 1].Value; }