Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# remove rows from datatable 
Csharp :: instantiate a player in photon 
Csharp :: Customize yup number 
Csharp :: how use unity interfaces 
Csharp :: convert xml string to file c# 
Csharp :: how to set picturebox width with form width in c# 
Csharp :: show snackbar without scaffold flutter 
Csharp :: unity3d find y position on navmesh 
Csharp :: website link c# 
Csharp :: or in if statement c# 
Csharp :: if statement c# 
Csharp :: unity switch 
Csharp :: unity image 
Csharp :: C# redirecttoaction with area 
Csharp :: c# run batch file 
Csharp :: c# round number up 
Csharp :: unity notification 
Csharp :: how to acivate a game object unity 
Csharp :: random in f# 
Csharp :: how to create public variable in c# 
Csharp :: c# handle dbnull value 
Csharp :: c# read all lines from filestream 
Csharp :: first person mouse look unity 
Csharp :: how to type to console in unity 
Csharp :: c# api bypass ssl certificate 
Csharp :: how to pass id from view to controller in asp.net core 
Csharp :: linq to json 
Csharp :: c# make file writable 
Csharp :: c# recursion formula for the factorial 
Csharp :: c# move form without border 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =