Alters the name of all matching files in the current directory on the disk in the specified drive.
Call with:
AH = 17H
DS:DX = segment:offset of "special" file control block
Returns:
If function successful (one or more files renamed)
AL = 00H
If function unsuccessful (no matching files, or new filename matched an existing file)
AL = FFH
Notes:
The special file control block has a drive code, filename, and extension in the usual position (bytes 0 through 0BH) and a second filename starting 6 bytes after the first (offset 11H).
The ? wildcard character can be used in the first filename. Every file matching the first file specification will be renamed to match the second file specification.
If the second file specification contains any ? wildcard characters, the corresponding letters in the first filename are left unchanged.
The function terminates if the new name to be assigned to a file matches that of an existing file.
[2.0+] An extended FCB can be used with this function to rename a directory.
[2.0+] Int 21H Function 56H, which allows full access to the hierarchical directory structure, should be used in preference to this function.
Example:
Rename the file OLDNAME.DAT to NEWNAME.DAT.
myfcb db 0 ; drive = default
db 'OLDNAME ' ; old file name, 8 chars
db 'DAT' ; old extension, 3 chars
db 6 dup (0) ; reserved area
db 'NEWNAME ' ; new file name, 8 chars
db 'DAT' ; new extension, 3 chars
db 14 dup (0) ; reserved area
.
.
.
mov ah,17h ; function number
mov dx,seg myfcb ; address of FCB
mov ds,dx
mov dx,offset myfcb
int 21h ; transfer to MS-DOS
or al,al ; check status
jnz error ; jump if rename failed
.
.
.