Optimising

Hi,

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.

HI @Le_Long1

Looks good to me. IF you try to do it using Linq or expressions that might just make it more complicated to understand.

Thanks

@Le_Long1 : You could have Club both IF condition using AND Operator, nothing else could have optimized I believe.

@Le_Long1

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

Cheers

Hi,

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)

Regards,

Hi, could you perhaps be so kind and elaborate a bit more? Maybe even show a screenshot? Thanks for the tip!

@Le_Long1

Check this

Hope this helps

cheers

Hi Anil_G!
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!

1 Like

@Le_Long1

Happy Automation

Please mark solution if resolved so that others with similar issue can get help

Cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.