AutoIt lacks a DirRename function and DirMove function is used to rename a folder/ directory.
Please note, if the destination already exists and the overwrite flag is specified when renaming the folder, then the source directory will be moved inside the destination.
The function returns 1 for success and 0 if there is an error renaming the directory. If the source directory does not exist, the function returns 0.
Please note, if the destination already exists and the overwrite flag is specified when renaming the folder, then the source directory will be moved inside the destination.
The function returns 1 for success and 0 if there is an error renaming the directory. If the source directory does not exist, the function returns 0.
Example:
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
;Rename "C:\test" to "C:\automationdevelopers" and get the status.
$bStatus = DirMove("C:\test", "C:\automationdevelopers")
;Display status message.
If $bStatus Then
MsgBox($MB_ICONINFORMATION, "Status", "Directory renamed successfully.")
Else
MsgBox($MB_ICONERROR, "Status", "Error renaming the directory.")
EndIf
#include <MsgBoxConstants.au3>
;Rename "C:\test" to "C:\automationdevelopers" and get the status.
$bStatus = DirMove("C:\test", "C:\automationdevelopers")
;Display status message.
If $bStatus Then
MsgBox($MB_ICONINFORMATION, "Status", "Directory renamed successfully.")
Else
MsgBox($MB_ICONERROR, "Status", "Error renaming the directory.")
EndIf
Related Posts
- AutoIt - How to Create a Folder
- AutoIt - How to Copy a Folder
- AutoIt - How to Move a Folder
- AutoIt - How to Delete a Folder
Interesting? Share and Let Others Know.
Post a Comment