Your dir1 is not actually a directory... I mean it could be but it really looks like a text file.
I am guessing you want to do this:
DirectoryInfo dir1 = new DirectoryInfo(@"C:\Users\Test");
DirectoryInfo dir2 = new DirectoryInfo(@"C:\Users\Test2");
FileInfo[] Folder1Files = dir1.GetFiles();
if (Folder1Files.Length > 0)
{
foreach (FileInfo aFile in Folder1Files)
{
if (File.Exists(dir2.Name + aFile.Name))
{
File.Delete(dir2.Name + aFile.Name);
}
aFile.MoveTo(dir2.Name + aFile.Name);
}
}
Note: I also added ".Name" to your directory info objects. This pulls the directory name rather than a direct ToString. Not sure what the direct ToString gets you but .Name is what you should use.