static string CreateNewFile(string path) { int count = 2; int extensionIndex = FileSystemHelpers.GetExtensionIndex(path); if (extensionIndex > 0 && FileSystemHelpers.IsDirectorySeparator(path[extensionIndex - 1])) { extensionIndex = path.Length; } string newPath; do { newPath = path.Insert(extensionIndex, count.ToString()); count++; } while (File.Exists(newPath)); return(newPath); }