83Plus:Software:usb8x/Asm Interface/MSD/DOS renameFileEntry

From WikiTI
Jump to: navigation, search

Synopsis

Name: DOS_renameFileEntry

Minimum usb8x version: 0.10

Renames a file or folder.

Inputs

  • HL points to an ASCIIZ string of the old file/directory name, including path (ex. "/test1/test2/RenameMe.txt")
  • DE points to an ASCIIZ string of the new name (ex. "NewName.txt")

Outputs

  • Entry is renamed
  • C set if problems

Destroys

  • AF, BC, DE, HL

Notes

This works with both file and folder names. Example code to rename "old.txt" to "new.txt" in the root directory:

ld hl,sOldName
ld de,sNewName
U_CALL DOS_renameFileEntry
...
sOldName: DB "/old.txt",0
sNewName: DB "new.txt",0

If you are writing an application, you must copy the strings you use to RAM first, or else usb8x will not be able to see them.

See Also

  • [[../FAT_lookupPath|FAT_lookupPath]] - Find whether specified file/directory exists