Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 2 - File Manager / File Manager Reference
High-Level HFS Routines / Accessing Information About Files and Directories


HRename

You can use the HRename function 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 in oldName, HRename changes it to the name in newName. Given a volume name or a volume reference number, it changes the name of the volume to the name in newName. Access paths currently in use aren't affected.

SPECIAL CONSIDERATIONS
You cannot use HRename to 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
noErr0No error
dirFulErr-33File directory full
dskFulErr-34Volume is full
nsvErr-35No such volume
ioErr-36I/O error
bdNamErr-37Bad filename
fnfErr-43File not found
wPrErr-44Hardware volume lock
fLckdErr -45File is locked
vLckdErr-46Software volume lock
dupFNErr-48Duplicate filename
paramErr-50No default volume
fsRnErr -59Problem during rename
dirNFErr-120Directory not found or incomplete pathname
afpAccessDenied-5000User does not have the correct access to the file

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996