How to open a file folder of current year and then look for another folder with specific date


I am needing my automation to run weekly, but there may not always be data/file to update. Therefore I am wanting the automation to:

  1. Look for the current year and open that folder (example: folder title “2018”)
  2. Then I want it to look for a folder to be dated 2 Mondays from the current date (example: if the automation runs on a Wednesday 10/8/2018, then it will then look for a file folder titled “10/22/2018”) then access the file within that folder titled “Routing Guide 10/22/2018”
  3. However, if there is not a folder dated for 2 Mondays from the current date then it will send an email “There is no data to update.”

I have tried several different options, but keep getting errors - specifically in my variable types. I can’t seem to figure out the correct one for what I am trying to accomplish. Step 2 in my above process is my main hold up. Still fairly new to UiPath and learning more and more everyday. Thank you!!


Well you can do this:

  1. Get the current year[Int32] = DateAndTime.Today.Year
  2. If you are having a path where all your folders are placed, the you can use folder[Array{string}] =Directory.GetDirectories(“your_parent_folder”,year)

Now, you cannot create a folder by the name 10/22/2018 - as it dosent allow /

So, if another format say 10222018 , you still get that type using the other thread below for Next Monday after 2 weeks with little formatting.

  1. If you dont get the folder say count of array = 0 then use Send IMAP/Outlook Mail Message

If you do, use Directory.GetFiles(“folder of 10222018”, “Routing Guide”+folder".extension") to get that file.

Then you ca process that file accordingly.

Let me know if any point is confusing you.


Thank you @nadim.warsi - I will be working on this in the upcoming days and will let you know if I have any other questions or issues! :grinning: