Important: The information in this document is obsolete and should not be used for new development.
HRename
You can use theHRenamefunction to rename a file, directory, or volume.
FUNCTION HRename (vRefNum: Integer; dirID: LongInt; oldName: Str255; newName: Str255): OSErr;
vRefNum- A volume reference number, a working directory reference number, or 0 for the default volume.
dirID- A directory ID.
oldName- An existing filename, directory name, or volume name.
newName- The new filename, directory name, or volume name.
DESCRIPTION
The HRename function changes the name of a file, directory, or volume. Given the name of a file or directory inoldName,HRenamechanges it to the name innewName. Given a volume name or a volume reference number, it changes the name of the volume to the name innewName. Access paths currently in use aren't affected.SPECIAL CONSIDERATIONS
You cannot useHRenameto change the directory in which a file resides. If you're renaming a volume, make sure that both names end with a colon.
- Note
- If a file ID reference exists for a file you are renaming, the file ID remains with the renamed file.
![]()
RESULT CODES