IFileInfo.MoveTo

Syntax

MoveTo(Destination: String);

Parameters

Destination - a path that corresponds to a directory into which a file should be moved.

Description

The MoveTo method moves a file into a directory passed by the parameter Destination.

Comments

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.

Example

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:

IFileInfo