Horje
if file exist rename c# Code Example
if file exist rename c#
int count = 1;

string fileNameOnly = Path.GetFileNameWithoutExtension(fullPath);
string extension = Path.GetExtension(fullPath);
string path = Path.GetDirectoryName(fullPath);
string newFullPath = fullPath;

while(File.Exists(newFullPath)) 
{
    string tempFileName = string.Format("{0}({1})", fileNameOnly, count++);
    newFullPath = Path.Combine(path, tempFileName + extension);
}




Csharp

Related
c# string split by length Code Example c# string split by length Code Example
c# findindex Code Example c# findindex Code Example
solidity get address of contract Code Example solidity get address of contract Code Example
implement custom string to datetime convert net core Code Example implement custom string to datetime convert net core Code Example
hashing a file in C# Code Example hashing a file in C# Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
13