public static String getValidPath(String path) { if (path.Substring(path.Length - 1) != Path.DirectorySeparatorChar.ToString()) { path = path + Path.DirectorySeparatorChar; } return path; }