Assignment 8, sorting files, problems


Having some issues getting further into this task. So I know how to create a folder, add all files into a variable. Then I have built a for each element in the variable (each file in the folder). Then I want to build a nested if, basically “if file 1 ends with .*.xlsx do this, if it ends with .txt do that, if else do this”.

My problem is that the ${allfiles.get(rad,1)} equals .*.xlsx doesn’t work. Any ideas how to solve this would be much appreciated. :slight_smile:

Try using For Each loop with the list of filenames, ans several If-Else conditions with “contains” operator.

Yes, works! Thanks. :slight_smile:

1 Like