[Overview][Constants][Types][Procedures and functions][Variables] Reference for unit 'oldlinux' (#rtl)

FReName

Rename file

Declaration

Source position: line 0

function FReName(

  OldName: Pchar;

  NewName: Pchar

):Boolean;

function FReName(

  OldName: String;

  NewName: String

):Boolean;

Description

FRenamerenames the file OldNameto NewName. NewNamecan be in a different directory than OldName, but it cannot be on another partition (device). Any existing file on the new location will be replaced.

If the operation fails, then the OldNamefile will be preserved.

The function returns Trueon succes, Falseon failure.

Errors

On error, errors are reported in LinuxError. Possible errors include:

sys_eisdir
NewNameexists and is a directory, but OldNameis not a directory.
sys_exdev
NewNameand OldNameare on different devices.
sys_enotempty or sys_eexist
NewNameis an existing, non-empty directory.
sys_ebusy
OldNameor NewNameis a directory and is in use by another process.
sys_einval
NewNameis part of OldName.
sys_emlink
OldPathor NewPathalready have tha maximum amount of links pointing to them.
sys_enotdir
part of OldNameor NewNameis not directory.
sys_efault
For the pcharcase: One of the pointers points to an invalid address.
sys_eaccess
access is denied when attempting to move the file.
sys_enametoolong
Either OldNameor NewNameis too long.
sys_enoent
a directory component in OldNameor NewNamedidn't exist.
sys_enomem
not enough kernel memory.
sys_erofs
NewNameor OldNameis on a read-only file system.
sys_eloop
too many symbolic links were encountered trying to expand OldNameor NewName
sys_enospc
the filesystem has no room for the new directory entry.

See also

UnLink

  

Unlink (i.e. remove) a file.