Search code examples
automationanywhere

How do i append today's date after the file name in Automation Anywhere?


I am trying to rename a file in the format like-

"FileName" $date$ ".xlsx"

However, the filename is saved with random numbers like, 24.xlsx. I have tried changing the date format from the variables manager screen and set it to mm/dd/yyyy, but still no luck. Any assist on this ?

The code in automation anywhere looks something like this: Rename Files C\Users\<username>\Documents\query.xlsx to "FileName $Date$ .xlsx"

enter image description here enter image description here

Expected result be something like : Filename 09152019.xlsx

Actual Result : 24.xlsx


Solution

  • Filename can't have / or : To rename the file as mentioned in the post use $Month$$Day$$Year$ if day or month less than 10, for example, 09/15/2019 it will be 9152019.

    So, to make it two numbers based you will need to use if condition to check the day and month values separately if less than 10 you will do variable operation to add 0 to the left.

    enter image description here