The Move method moves an existing file to a new location with the same or a different file name. The Move method takes the full path of the move file. The Move method deletes the original file.
The following code snippet moves the source file to the destination file.
string fileName = @"C:fileName.txt"; FileInfo filetomove = new FileInfo(fileName); string destinationFile = @"C:destinationFile.txt"; try { filetomove.MoveTo(destinationFile); } catch (IOException ex) { Console.WriteLine(ex.Message); }