Hello,
I am trying to send files from one directory to another and then renaming them to a ordered list of numbered files. The only problem is when you do it once and then do it again the file numbering goes back to 0 so is unable to move as file name already exists. How do it get it to move and rename from the last named file that was moved and renamed?
Thanks.
Private void butSort3_Click(object sender, EventArgs e)
{
DirectoryInfo di = new DirectoryInfo(@"C:\new3");
FileInfo[] fiArr = di.GetFiles("*.txt");
int iCtr = 0;
try
{
foreach (FileInfo fri in fiArr)
{
MessageBox.Show(fri.FullName.ToString(), "File Manager", MessageBoxButtons.OK);
fri.MoveTo(@"C:\new4\File" + "1(" + iCtr
+ ").txt");
iCtr++;
RefreshDirSize1();
RefreshDirSize2();
RefreshDirSize3();
RefreshDirSize4();
}
}