Alteryx Designer Desktop Discussions

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

List of files in a directory containing a string

BonusCup
10 - Fireball

Hi,

Is there a way to list out all the csv files in a directory that contain a specific string in the data, not in the filename? I want to find all the files that contain "xyz" in the data and then sort the filenames in descending order to pull the most current data for that string.

 

thanks in advance

 

 

5 REPLIES 5
jeff_reynolds
10 - Fireball

Are you looking for a specific string in the actual file name? If so, then the Directory Tool (In / Out) is what you're looking for. Can't share a workflow, but hopefully the image below gets you where you need to be. 

 

Good luck. 

 

directorytool.png

BonusCup
10 - Fireball

@jeff_reynolds 

Thanks, Jeff.  I'm actually looking for the filenames where the specific string is actually in the data.  I know what column it would be in so I wonder if I could use that as part of the filter too.

jeff_reynolds
10 - Fireball

hmmm....so perhaps what I posted is step 1. With the list of files you could build a macro to open each, search the column for the string you want, and then capture the file names of the files that contain the data you're looking for. Good luck!

carlmcgowan
5 - Atom

Hey BonusCup,

 

Hopefully I am understanding you correctly. I have attached a workflow that:

 

  • Takes a list of files through a directory tool
  • Opens them with a dynamic input tool (and places the full path in a new column)
  • Filters in [Column4] for "Find"
    • You mentioned you know the field to search, you can change [Column4] to your field name
    • The value "Find" is the word you are looking for in the field
  • Joins back to the original data to use the creation date for sorting
  • Sorts creation date descending
    • You can change this from creation date to last modified date

My input data looks like this:

 

Capture.PNG

 

BonusCup
10 - Fireball

@carlmcgowan 

 

Thanks, this was exactly what I needed....

 

That was actually the second part of my workflow I was working on.  The first part of my workflow finds multiple different IDs that I need to "Find" in that specific [Column4].  Some days there is only 1 ID and other days there could be multiple IDs to look up.  I'm hoping to automate the lookup where I manually entered the ID into the [Column4] filter of your example.

 

Thanks again, your example worked perfectly.  If you have any insight on the dynamic lookup please let me know.

Labels