Mono Class Library: Mono.Unix.Native.Stdlib Overview | Members

Mono.Unix.Native.Stdlib.rename Method

Rename oldpath to newpath. [Edit]

public static int rename (string oldpath, string newpath)

Parameters

oldpath
The old path name. [Edit]
newpath
The new path name. [Edit]

Returns

The rename() function returns the value 0 if successful; otherwise the value -1 is returned and Stdlib.GetLastError indicates the error. [Edit]

Remarks

The rename() system call causes the link named oldpath to be renamed as newpath. If newpath exists, it is first removed. Both oldpath and newpath must be of the same type (that is, both directories or both non-directories), and must reside on the same file system.

The rename() system call guarantees that if newpath already exists, an instance of newpath will always exist, even if the system should crash in the middle of the operation.

If the final component of oldpath is a symbolic link, the symbolic link is renamed, not the file or directory to which it points.

[Edit]

Requirements

Namespace: Mono.Unix.Native
Assembly: Mono.Posix (in Mono.Posix.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0