Does anyone have any idea how to auto adjust dynamically file extensions?
I have a bot that will go into SAP and download a bunch of attachments. However, sometimes it might be .TIF, .JPG, .xlsx, .PDF. In the screenshot, the bot renames the files based on the current SAP Document Number (Variable: FileName) that it has open. But I’m looking for ways to dynamically change the file extension. Any ideas?
In this case, we can use GetExtension method and GetFileNameWithoutExtension method.
System.IO.Path.GetExtension method returns extension. for example, System.IO.Path.GetExtension("209267517.PDF") returns ".PDF"
System.IO.Path.GetFileNameWithoutExtension method returns filename without extension. for example, System.IO.Path.GetFileNameWithoutExtension("209267517.PDF") returns "209267517"