.rename Method
Function: |
Renames a file specified by its name. |
Syntax: |
fd.create(byref old_name as string, byref new_name as string) as pl_fd_status_codes |
Returns: |
One of the following pl_fd_status_codes, also affects fd.laststatus: 0 — PL_FD_STATUS_OK: Completed successfully. 1 — PL_FD_STATUS_FAIL : Physical flash memory failure (fatal). 2 — PL_FD_STATUS_CHECKSUM_ERR: Checksum error has been detected in one of the disk sectors (fatal). 4 — PL_FD_STATUS_INV_PARAM: Old_name is a NULL string, which is not allowed. 5 — PL_FD_STATUS_DUPLICATE_NAME: File with the new_name already exists. 8 — PL_FD_STATUS_NOT_READY: The disk is not mounted. 9 — PL_FD_STATUS_NOT_FOUND: The old_name file is not found. 14 — PL_FD_STATUS_TRANSACTION_CAPACITY_EXCEEDED: Too many disk sectors have been modified in the cause of the current transaction (fatal). |
See Also: |
Creating, Deleting, and Renaming Files, File Names and Attributes, fd.create, fd.delete, fd.getnumfiles, fd.maxstoredfiles |
Part |
Description |
old_name |
A string (1-56 characters) with the name of the file to be renamed. All characters after the first space encountered (excluding leading spaces) will be ignored. File names are case-sensitive. |
new_name |
A string (1-56 characters) with the new name for the file. All characters after the first space encountered (excluding leading spaces) will be ignored. |
Details
Renaming a file preserves file attributes.
This method makes changes to the sectors of the flash disk. For the highest possible reliability, use disk transactions when invoking it.