Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Searching multiple keywords within multiple files in a folder and its sub-folders

aesanchez
7 - Meteor

What would be a good approach for searching multiple keywords within multiple files in a folder and its sub-folders? 

 

In the posting below, the Search Directory tool is recommended. I have used it successfully for a single keyword, and in .txt files only. I was unable to apply it to .docx files. 

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Key-word-searching-in-multiple-files-a...

 

For .xlsx files, the CReW macro Wildcard XLSX Input provide a good path. 

 

I am excluding .pdf and images as it seems that those require separate handling. 

 

Thanks

5 REPLIES 5
mceleavey
17 - Castor
17 - Castor

Hi @aesanchez ,

 

You could use the Directory input to determine the file type that you wish to bring in. Then, you can use a text input to create a list of the keywords you would like to include, then simply build a macro with a control parameter of each keyword applying a filter to the filename where the keyword is contained.

 

This would bring in a list of all, for example .csv files in the folder and subfolders, then will cycle through an bring in all that contain each keyword.

 

M.



Bulien

aesanchez
7 - Meteor

Hi @mceleavey 

 

Would that work to identify the files where the keywords are contained in the filename? I need to accomplish that, and also identify the files that contain the keywords within their content The Search Directory tools is working right now for .txt files but not .docx. 

mceleavey
17 - Castor
17 - Castor

Hi @aesanchez ,

 

That would only deal with the filenames. Once you've loaded them in then can apply a filter using the same Keyword text input (or whatever format) to search for the words within the content. That part is easy as you are simply dealing with text within the data once it's loaded in.

 

I've attached the macro for you. Hope it helps.

 

M.



Bulien

mceleavey
17 - Castor
17 - Castor

For some reason it won't allow me to attach macros, so I've saved it as a workflow. You'll have to save it as a macro at your end.



Bulien

aesanchez
7 - Meteor

Thank you. This points me in the right direction. 

Labels