How to process specific file First, out of 10 files?

Hello everyone,

These are my Files.

I have an process where I have to process the file FIRST which has “Dollar” as keyword.
How can I process that file with a keyword “Dollar” and then process other.

please follow these steps:

  1. Get all the files from folder.
  2. loop over to get one by one
  3. inside loop read text file.
  4. put if after read text file and put condition through string.contains
  5. in if-then block use that file first
1 Like


Use directory.Getfiles("folderpath","*DOLLAR*")

This will give you array of files with dollor in them…

Use for loop and process them and then get the remaining files


1 Like

I already tried this.

But it won’t work as expected.

Loop will start from pxcv_1 and so on. Which means loop will first process pxcv_1

@prabin_chand1 can you tell me …dollar mark is inside or dollar will be in file name.

It means I have to write two same sequence for two scenario ?
Is there anything else logic? so that with one sequence I can complete it

@prabin_chand1 ok got it. I did not see dollar is in file name.

@prabin_chand1 To avoid from two sequence
Please follow this one.

  1. First get all the files from folder.
  2. Then rearrange by key word (dollar)
  3. Dollar containing files come on top.
  4. Now you can read first dollar containing files then others

Happy Automation.

1 Like


As you need dollor related files to be done first…it wpuld be better to use two different sequences itsef…that way we can complete the dollor related files first and then do the non dollor files


1 Like