Rename Multiple Files

This process prompts the user to select a folder and renames all the files within that folder by appending the current date to each file’s name.

Display.SelectFolder Description:'Please select the folder whose files will be renamed. Press Cancel to exit.' \
                    InitialDirectory:'' \
                    IsTopMost:False \
                    SelectedFolder=> SelectedFolder \
                    ButtonPressed=> ButtonPressed

if ButtonPressed='OK' then

    Folder.GetFiles Folder: SelectedFolder  \
                    FileFilter:'*' \
                    IncludeSubfolders:False \
                    FailOnAccessDenied:True \
                    SortBy1:Folder.SortBy.NoSort \
                    SortDescending1:False \
                    SortBy2:Folder.SortBy.NoSort \
                    SortDescending2:False \
                    SortBy3:Folder.SortBy.NoSort \
                    SortDescending3:False \
                    Files=> FilesToBeRenamed

#Renames all files in the folder following a scheme. In this specific case, a timestamp is added in the files' names.

    DateTime.Current DateTimeFormat:DateTime.DateTimeFormat.DateAndTime \
                    Offset:'0' \
                    CurrentDateTime=> CurrentDateTime

    File.RenameAddDateOrTime Files: FilesToBeRenamed   \
                    DateTimeToAdd:File.DateTimeToAdd.Current \
                    DateTimePosition:File.AddTextPosition.AfterName \
                    DateTimeSeparator:File.Separator.Space \
                    DateTimeFormat:'yyyy-MM-dd' \
                    IfFileExists:File.IfExists.DoNothing \
                    RenamedFiles=> RenamedFiles

end

Display.ShowMessage Title:'Process Completed!' \
                    Message:'Process "Rename Multiple Files" completed.' \
                    Icon:Display.Icon.None \
                    Buttons:Display.Buttons.OK \
                    DefaultButton:Display.DefaultButton.Button1 \
                    IsTopMost:False \
                    ButtonPressed=> ButtonPressed