Hello
I have a process I am download excel file
This file get dynamic name like : SOD-TestCaseLog-2023-06-08_12-20-20.xlsx
I want to change the name of the file for example to : CartReport.xlsx
How can I do that please ?
Hi @mironb
Can you provide us some more file names, so that we can analyze which part of the file name is going to remain constant & which part changes?
Best Regards.
@arjunshenoy Hi
I just made a process that download test set from Test Manager of the UiPath so all the files are the same
You can iterate through each currentFile through the list of fileNames & you can use the following expression to check for the static part of the file name. If it matches, then you can proceed with the renaming actions:
System.Text.RegularExpressions.Regex.IsMatch(currentFile.ToString,"^SOD-TestCaseLog-")
Hope this helps,
Best Regards.
@arjunshenoy
What is the âcurrentFileâ ?
What to fill in the rename activity ?
- Letâs say you are downloading all the files in a folder called âDownloadFolderâ. You will be getting all the file names into an array variable called
filesArray
, like this:
- Once you have all the file names in the array variable, you start iterating through the array using a For Each loop, like this:
- In each iteration here,
currentFile
contains the name of the present file in the iteration. Then you check whether the file name starts with the static part â^SOD-TestCaseLog-â, like this:
- If the condition is matched (that means the currentFile starts with â^SOD-TestCaseLog-â), the control comes to the true block & the file renaming sequence takes place, like this:
Edit: Please find the sample workflow file for your reference-
Demo.xaml (10.2 KB)
Hope this helps,
Best Regards.
@arjunshenoy
Thank you very much
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.