I wrote this code in c# for change location of folder and all sub-folders of this folder. I want to change name of all folders when copy it to destination. for example I want to change name from 1 to .... . how should I change my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;
namespace Folder
{
    class clssMoveFolder
    {
        string temppath;
        public string StrtxtSource;
        public string destDirName;
        public void Directorycopy(string sourceDirName, string destDirName, bool cutSubDirs, string strExtension)
        {
           try
            {
                DirectoryInfo dir = new DirectoryInfo(sourceDirName);
                DirectoryInfo[] dirs = dir.GetDirectories();
                // If the source directory does not exist, throw an exception.
                if (!dir.Exists)
                {
                    throw new DirectoryNotFoundException("Source directory does not exist or could not be found: " + sourceDirName);
                }
                FileInfo[] files = dir.GetFiles();
                if (!Directory.Exists(destDirName))
                {
                    Directory.CreateDirectory(destDirName);
                }
                //Get the file contents of the directory to copy.
                for (int a = 0; a < files.Length; ++a)
                {
                    // Create the path to the new copy of the file.
                    if (files[a].Extension == "."+strExtension  )
                    {
                        temppath = Path.Combine(destDirName, files[a].Name);
                        files[a].MoveTo(temppath);
                    }
                    else if (files[a].Extension == strExtension)
                    {
                        temppath = Path.Combine(destDirName, files[a].Name);
                        files[a].MoveTo(temppath);
                    }
                    else if (strExtension == "AllFiles")
                    {
                        temppath = Path.Combine(destDirName, files[a].Name);
                        files[a].MoveTo(temppath);
                    }
                    else
                        files[a].Delete();
                   dir.Refresh();
                }
                FileInfo[] filesCheck = dir.GetFiles();
                if (dirs.Length == 0 && filesCheck.Length == 0 && dir.Name != StrtxtSource)
                {
                    dir.Delete();
                }
                // If copySubDirs is true, copy the subdirectories.
                if (cutSubDirs)
                {
                    foreach (DirectoryInfo subdir in dirs)
                    {
                        // Copy the subdirectories.
                        string temppath= Path.Combine(destDirName, subdir.Name);
                        Directorycopy(subdir.FullName, temppath,cutSubDirs,strExtension);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
    }
}
 
    