public static string GetFtpPath(this string path) { if (String.IsNullOrEmpty(path)) return "./"; path = Regex.Replace(path.Replace('\\', '/'), "[/]+", "/").TrimEnd('/'); if (path.Length == 0) path = "/"; return path; }