The Move
method moves an existing file to a new location with the same or a different
file name. The Move method takes two parameters. The Move method deletes the
original file.
The
following code snippet moves the source file to the destination file.
string
sourceFile = @"C:\Temp\MaheshTX.txt";
string
destinationFile = @"C:\Temp\Data\MaheshTXMoved.txt";
try
{
File.Move(sourceFile, destinationFile);
}
catch
(IOException iox)
{
Console.WriteLine(iox.Message);
}