Show / Hide Table of Contents

Method filesystem.move


Overload

Moves (changes path of) file or directory.

public static void move(string path, string newPath, FIfExists ifExists = FIfExists.Fail)
Parameters
path  (string)

Full path.

newPath  (string)

New full path.

note

It is not the new parent directory. See filesystem.moveTo.

ifExists  (FIfExists)
Exceptions
ArgumentException

path or newPath is not full path (see pathname.isFullPath).

FileNotFoundException

path not found.

AuException

Failed.

Remarks

In most cases uses API MoveFileEx. It's fast, because don't need to copy files. In these cases copies/deletes: destination is on another drive; need to merge directories. When need to copy, does not copy security properties; sets default. Creates the destination directory if does not exist (see filesystem.createDirectory). If path and newPath share the same parent directory, just renames the file.