Following class will help you in moving files from one folder to another.

public class TransferFiles
    {
        public void MoveAndDelete(string dirPath, string dir, string FileName)
        {
            string NewFileName = FileName;
            try
            {
                if (File.Exists(dir + @"\" + NewFileName))
                {
                    File.Delete(dir + @"\" + NewFileName);
                    File.Move(dirPath + @"\" + NewFileName, dir + @"\" + NewFileName);
                }
                else
                {
                    File.Move(dirPath + @"\" + NewFileName, dir + @"\" + NewFileName);
                }
            }
            catch (Exception E)
            {
               //Error handling code
            }           
        }
    }

Pawan Kumar
Pawankkmr@hotmail.com

Advertisements