MoveTo(Destination: String);
Destination - path that corresponds to the directory, into which a file must be moved.
The MoveTo method moves a file into the directory passed by the Destination parameter.
If a file with the same name exists in the specified directory, the current file will be renamed after moving. A new file name is formed as the name of the copy of existing file in accordance with the algorithm contained in operating system.
Sub UserProc;
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 UserProc;
After executing the example the file is moved into the folder C:\Temp.
See also: