Find a file with extension

Can you tell me how to find a file in a folder with a specific extension? For example, png.

There may be several possible solutions. Suppose that the array with names is called files_array.

1. filtered_array = files_array.filter(x => x.includes(".jpg")) - filter the array so that all the elements that have the .jpg extension remain.
2. Cycle by files_array. Use the “File Information” function and specify the full path. At the output we get the object with the values. One of the fields is extension. Further condition: if current_file_info.extension === "jpg", you execute a branch. If not, you do not execute or execute another one. Since your file array contains only names, and we need full paths, you can add the rest of the path to all the elements at once. For example: => "C:\\tmp\\" + x)

That’s how your workflow would look like for the first case. It’ll be the best way.