Share via


Move Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Moves a specified file to a new ___location, providing the option to specify a new file name.

Namespace:  System.IO
Assembly:  System.IO (in System.IO.dll)

Syntax

'Declaration
Public Shared Sub Move ( _
    sourceFileName As String, _
    destFileName As String _
)
public static void Move(
    string sourceFileName,
    string destFileName
)
public:
static void Move(
    String^ sourceFileName, 
    String^ destFileName
)
static member Move : 
        sourceFileName:string * 
        destFileName:string -> unit 
public static function Move(
    sourceFileName : String, 
    destFileName : String
)

Parameters

Remarks

This method works across disk volumes, and it does not throw an exception if the source and destination are the same. Note that if you attempt to replace a file by moving a file of the same name into that directory, you get an IOException. You cannot use the Move method to overwrite an existing file.

The sourceFileName and destFileName arguments are permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see GetCurrentDirectory.

If you try to move a file across disk volumes and that file is in use, the file is copied to the destination, but it is not deleted from the source.

.NET Framework Security

See Also

Reference

File Class

System.IO Namespace