Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Filter filelist

What is the best method to exclude files with a specific name?  For example if I have a script that wants to loop through a folder picking up every file EXCEPT a file that includes the word 'CAT', how can I do it?

'CAT.xlsx' doesn't get loaded

'Dog.xlsx' does

Wombat.xlsx does

...

I'm attempting to loop using:

for each FoundFile in filelist( Root & '\*.' & FileExtension)

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

In your For Loop:

IF (NOT WildMatch('$(FoundFile)','*CAT*')) THEN

   LOAD etc

ENDIF

-Rob

Not applicable
Author

Very helpful, thanks rwunderlich‌.