May 24, 2023, 11:24am
I am currently working on a robot to do some repetetive tasks (the process is described below) and I have a basic framwork done, but I was wondering if there was any way to “optimise” it or make it easier / declutter it? Any tips, pointers or ideas are very welcome, I am still fairly new to UiPath and eager to learn. Thank you in advance!
So the bot goes through a folder with folders in it, it should check every folder inside and if it contains “CL” in its name, AND is not older as 90 days, then it should go into it and check all the files inside for any named “CL” again.
May 24, 2023, 11:31am
Looks good to me. IF you try to do it using Linq or expressions that might just make it more complicated to understand.
@Le_Long1 : You could have Club both IF condition using AND Operator, nothing else could have optimized I believe.
May 24, 2023, 8:00pm
Instead of if condition for folder use the inbuilt filter in the for each activity
And order them by newest first so that in your if condition once you find a file older than 90 days then break the loop using break so that other files loop is not run at all
Hope this helps
May 24, 2023, 11:12pm
W can directly get target files using the following expression.
arrFiles = System.IO.Directory.GetDirectories("targetFolder","*CL*").SelectMany(Function(d) System.IO.Directory.GetFiles(d,"*CL*")).ToArray()
Also we might be able to add date condition (90 days) to the above expression.
How do you get dateToCompare in the original workflow?
Sample20230525-2L.zip (4.1 KB)
May 25, 2023, 6:41am
Hi, could you perhaps be so kind and elaborate a bit more? Maybe even show a screenshot? Thanks for the tip!
May 29, 2023, 6:17am
Sorry for the late reply, the screenshot helped very much and everything works, thank you for the tip and your time, have a nice day!
May 29, 2023, 6:20am
Please mark solution if resolved so that others with similar issue can get help
June 1, 2023, 6:21am
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.