Advertisement
LittleBoy0311

CheckFileExsist

Sep 5th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.37 KB | None | 0 0
  1. private void CheckExsist(ref string sourcePath, ref int counter)
  2. {
  3.     if (System.IO.File.Exists(sourcePath))
  4.     {
  5.         sourcePath = sourcePath.Replace(Path.GetFileName(sourcePath), Path.GetFileNameWithoutExtension(sourcePath) + "(" + counter + ")" + Path.GetExtension(sourcePath));
  6.         counter += 1;
  7.         CheckExsist(ref sourcePath, ref counter);
  8.     }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement