LATEST UPDATES
ShareHolder Finder v0.9.1 is now released!!! Check Product Page for more details.
✉ info@automationdevelopers.com

ITS ALL ABOUT AUTOMATION

Sunday, 9 October 2016

AutoIt - How to Rename a Folder


Author Post Date Sunday, 9 October 2016
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.

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

Related Posts





Interesting? Share and Let Others Know.

Post a Comment