FSpRename
You can use the FSpRename function to rename a file or directory.
FUNCTION FSpRename (spec: FSSpec; newName: Str255): OSErr;
spec
- An
FSSpec record specifying the file or directory to rename.
newName
- The new name of the file or directory.
DESCRIPTION
The FSpRename function changes the name of a file or directory. If a file ID reference for the specified file exists, it remains with the renamed file.
SPECIAL CONSIDERATIONS
If you want to change the name of a new copy of an existing file, you should use the FSpExchangeFiles function instead.
ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for FSpRename are
| Trap macro | Selector |
| _HighLevelHFSDispatch | $000B |
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 to the file |