How can I search files inside a directory with a "For Each File" step?

Follow

Please refer to the information below.

(Example) Only searching and looping through ".txt" files in the "bizrobo_test" folder which contains both ".txt" and ".xlsx" files.

▼Inside this folder

1.png

 ▼Action tab of the "For Each File" step

2.png

 

Directory Name
Set the directory to loop through
(Example) c:\bizrobo_test


Include Subdirectories
If checked, the files of sub-directories (and all levels below) under the set directory will be included. If unchecked, only the files directly under the set directory will be included.


File Name Pattern
Only the file(s) that has/have a name matching the entered pattern will be included.
(Example) .*.txt
Please refer to "How to extract characters by pattern in DS?", for a method to describe patterns.

 

Store File Names Here
Set a variable to register the name (or path) of the current file at each iteration.
(Example) file_name

 

 

Executing a "For Each File" step with the above settings, will give the "file_name" variable the values below.

First loop:「c:\bizrobo_test\01.txt.txt」

3.png

 

 Second loop:「c:\bizrobo_test\02.txt.txt」

4.png

 

Third loop:「c:\bizrobo_test\03.txt.txt」

5.png

 

You can see that only the ".txt" files of the "bizrobo_test" folder have been looped through.

 

 

"The Step could not be reached. The For Each File action did not find any files."

If this error message appears when using a "For Each File" step, please refer to "For loop steps such as "For Each File", the "Try Next Alternative" setting is not performed and an error occurs".

1 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.