Function 17h Rename File with FCB

mov dx, seg FilesFCB

mov ds, dx

mov dx, offset FilesFCB ;ds:dx points to RENAMEFCB

mov ah, 17h ;Rename File with FCB

int 21h

cmp al, 0 ;zero means success

jne error_handler

Rename File with FCB (Function 17h) changes the name of an existing file.

This function has been superseded by Rename File (Function 56h).

Parameter

FilesFCB

Points to a RENAMEFCB structure that contains the old and new names for the file. The RENAMEFCB structure has the following form:

RENAMEFCB STRUC

renDriveID db ? ;drive no. (0=default, 1=A, etc.)

renOldName db '????????' ;old filename

renOldExtent db '???' ;old file extension

renReserved1 db 5 dup(?) ;reserved

renNewName db '????????' ;new filename

renNewExtent db '???' ;new extension

renReserved2 db 9 dup(?) ;reserved

RENAMEFCB ENDS

For a full description of the RENAMEFCB structure, see Chapter 3, “File System.”

Return Value

If the function is successful, the AL register contains 00h. Otherwise, the AL register contains 0FFh.

Comments

If the filename in the RENAMEFCB structure contains wildcards, all matching files are renamed.

If the new name matches the name of an existing file, the function returns 0FFh without renaming the file.

See Also

Function 56h Rename File