in Delphi Directory Routines ::The RTL's RenameFile changes the name of a specified file. The implementation of the RenameFile function calls the MoveFile API function. MoveFile can rename folders, therefore Delphi's RenameFile can also rename folders and not only files. What's more RenameFile CAN move folders, also!
Read the full article to learn how to Use RenameFile to Rename a Directory