Open file in Folder without telling name of file

Hey experts,

how can I make the roboter open file in folder without telling the roboter the name of the file?
Because the files in the folder will have allways different names.
My process looks like that until now:

  1. crate array wit files of a specif folder (folder path is known)
  2. check if the folder has any files
  3. if folder has files, open file. But I don’t know how to open that file without giving the name of file.

Please help.

1 Like

@Ilga_Muller

Try below expression to find all files under folder

 getFiles [] = Directory.GetFiles("FolderPath")

And then use ForEach loop to iterate one by one file.

  ForEach item in getFiles
     - use Start Process activity and pass item to open one by one file.
1 Like

Hi
hope these steps would help you resolve this

–use a assign activity like this
arr_files = Directory.GetFiles(“yourfolderpath”)
where arr_files is a variable of type array of string

–now use a IF condition like this
arr_files.Count>0
IF true it will go to THEN part where we can use FOR EACH activity

–in FOR EACH activity pass the variable arr_files as input and chagne the type argument as string in the property panel
–inside the loop use a START PROCESS activity and pass the input as item.tostring in the filename property so that it will bring to foreground

Cheers @Ilga_Muller

2 Likes

Thank you very much, its working!

1 Like

Cheers @Ilga_Muller

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