FpRename function
Rename file.
Declaration
function FpRename(old: PAnsiChar; newpath: PAnsiChar): cintDescription
FpRename renames the file
Old to
NewPath.
NewPath can be in a different directory than
Old, but it cannot be on
another partition (device). Any existing file on the new location will be replaced.
If the operation fails, then the Old file will be preserved.
The function returns zero on success, a nonzero value indicates failure.
Note: There exist a portable alternative to fpRename: system.rename. Please use fpRename only if you are writing Unix specific code. System.rename will work on all operating systems.
Errors
Extended error information can be retrieved using fpGetErrno.
- sys_eisdir
-
NewPathexists and is a directory, butOldis not a directory. - sys_exdev
-
NewPathandOldare on different devices. - sys_enotempty or sys_eexist
-
NewPathis an existing, non-empty directory. - sys_ebusy
-
OldorNewPathis a directory and is in use by another process. - sys_einval
-
NewPathis part ofOld. - sys_emlink
-
OldPathorNewPathalready have the maximum amount of links pointing to them. - sys_enotdir
- part of
OldorNewPathis 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
OldorNewPathis too long. - sys_enoent
- a directory component in
OldorNewPathdidn't exist. - sys_enomem
- not enough kernel memory.
- sys_erofs
-
NewPathorOldis on a read-only file system. - sys_eloop
- too many symbolic links were encountered trying to expand
OldorNewPath - sys_enospc
- the file system has no room for the new directory entry.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
