If you are using Visual C# to change the file name (renaming the file) then you must use something similar to the below code:
Code:
using System;
using System.IO;
namespace FileRename
{
class MyClass
{
static void Main(string[] args)
{
try
{
DirectoryInfo mydir = new DirectoryInfo(@"F:\Pictures\New Folder");
FileInfo[] a = mydir.GetFiles("*.jpg");
int i = 0, j = 0;
string filePath;
foreach (FileInfo j in a)
{
filePath = @"F:\Pictures\New Folder\" + "pic" + i.ToString(j)+".jpg";
a.MoveTo(filePath);
i++;
j++;
}
Console.WriteLine("Successful");
}
catch (Exception e)
{
Console.WriteLine("Failed", e.ToString());
}
}
}
}
Bookmarks