Rename File Using Move File

Hi, I am using RPA.Browser.Selenium library. I want to rename my excel file. I use the Move File method. I manage to rename the file, I would like to add additional today’s date after the naming. I did as below it is successful but not sure why it created a folder instead of renaming it. Any help?

Rename My File

${Today}=    Get Current Date
${convert}=    Convert Date    ${Today}    %m/%d/%Y

Move File
...    ${excelDownload}/${filename}
...    ${excelDownload}/MyFileName_${ID}_${convert}.xlsx

If I exclude the date behind it manage to rename as normal. Help needed. Thanks.


Hi @robocorp19 ,

Are you sure you are using RPA.Browser.Selenium? that library doesn’t have Get Current Date, Convert Date or Move File keywords, perhaps you are using RPA.FileSystem and DateTime?

The reason it’s probably not working is the forward slash (/) in the date format, that’s not a valid character in a file name on any OS (well except Mac OS <10, but I doubt your using a 20 year old Mac?)

I’ll suggest you try changing:

${convert}=    Convert Date    ${Today}    %m/%d/%Y


${convert}=    Convert Date    ${Today}    %m-%d-%Y

See if that resolves your issue.


1 Like

Great. I was thinking something wrong with the library. I use OperatingSystem. Is working fine now. Hope this topic able to help others as well. Thanks.

1 Like