Is File Existed
using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.Windows.Forms; using System.Text.RegularExpressions; using System.IO; using System.Drawing.Imaging; using System.Reflection; namespace SuchSofts.OpenImage.Lib.Operation { internal class CommonOperations { public static bool IsFileExisted(string path, ref string name) { if (File.Exists(path + name)) { string mainName = name; string exName = ""; int exStartIndex = name.LastIndexOf("."); if (exStartIndex != -1) { mainName = name.Substring(0, exStartIndex); exName = name.Substring(exStartIndex); } for (long i = 1; File.Exists(name = (mainName + i.ToString() + exName)); i++) ; return false; } else { return true; } } } }