MoveTo(Destination: String);
Destination - a path that corresponds to a directory into which a file should be moved.
The MoveTo method moves a file into a directory passed by the parameter Destination.
If a file with the same name exists in a specified directory, current file will be renamed after moving. New filename is formed as the name of the copy of existent file in accordance with the algorithm, foreseen in operating system.
Sub Main;
Var
FileInf: IFileInfo;
Begin
FileInf:=New FileInfo.Attach("c:\Work\1.txt");
If FileInf.Exists And Directory.Exists("c:\Temp") Then
FileInf.MoveTo("c:\Temp");
End If;
Dispose FileInf;
End Sub Main;
After executing this example, a file is moved into a directory c:\Temp.
See also: