Run different workflow for different (1st 3 characters) filenames

Hi,

Need help on this:

I have a folder containing 10 pdfs but with 2 types of filenames
e.g. 5 of them starts from AAA_111.pdf to AAA_555.pdf
and the remaining 5 files starts from BBB_111.pdf to BBB_555pdf
They are all in the same folder

I would like to seek your help on how to design a bot to:

  1. Read the first 3 characters of each file and
  2. if it is AAA, run Workfow1, if it is BBB run Workflow 2

I managed to do Step 1 but I do not know how to get the Bot to scroll through each file, read first 3 characters and run the correct workflow.

I am a newbie to UiPath

Thank you

Hello @ayeo22

Hope you are trying to get all the file names and then split the filename and get the first 3 characters. Then use the if condition .

Do as below:

1). Directory.GetFiles(“folderpath”,”*.pdf”)
2) use a foreach loop to loop through the file names
3) use item.split(“_”)(0).ToString. (Gives the first 3 characters)
4) use if condition to check the filename condition