PBHRename
You can use the PBHRename function to rename a file, directory, or volume.
FUNCTION PBHRename (paramBlock: HParmBlkPtr; async: Boolean):
OSErr;
paramBlock
- A pointer to a basic HFS parameter block.
async
- A Boolean value that specifies asynchronous (
TRUE) or synchronous (FALSE) execution.
| --> | ioCompletion | ProcPtr | A pointer to a completion routine. |
| <-- | ioResult | OSErr | The result code of the function. |
| --> | ioNamePtr | StringPtr | A pointer to a pathname. |
| --> | ioVRefNum | Integer | A volume specification. |
| --> | ioMisc | Ptr | A pointer to the new name for the file. |
| --> | ioDirID | LongInt | A directory ID. |
DESCRIPTION
Given a pointer to the name of a file or directory in ioNamePtr, PBHRename changes it to the name pointed to by ioMisc. Given a pointer to a volume name in ioNamePtr or a volume reference number in ioVRefNum, it changes the name of the volume to the name pointed to by ioMisc.
- Note
- If a file ID reference exists for the file being renamed, the file ID remains with the file.
- IMPORTANT
- You cannot use
PBHRename to change the directory in which a file
is located.
ASSEMBLY-LANGUAGE INFORMATION
The trap macro for PBHRename is _HRename.
RESULT CODES
| noErr | 0 | No error |
| dirFulErr | -33 | File directory full |
| dskFulErr | -34 | Volume is full |
| nsvErr | -35 | No such volume |
| ioErr | -36 | I/O error |
| bdNamErr | -37 | Bad filename |
| fnfErr | -43 | File not found |
| wPrErr | -44 | Hardware volume lock |
| fLckdErr | -45 | File is locked |
| vLckdErr | -46 | Software volume lock |
| dupFNErr | -48 | Duplicate filename and version |
| paramErr | -50 | No default volume |
| fsRnErr | -59 | Problem during rename |
| dirNFErr | -120 | Directory not found or incomplete pathname |
| afpAccessDenied | -5000 | User does not have the correct access |