Hi all,
I have a workflow that uses a macro to import delimited .txt files from a certain directory. When I receive these files, they are all named similarly, but about half of them are structured differently and aren't relevant to my workflow. (See examples, attached.)
Is there a way to exclude these extraneous files based on the data contained within? For example, the needed files all have "Line items" as the first row, while the other files don't; could I maybe use that somehow?
I've been pulling my hair out on this one, and I didn't have much to start with, so any help would be appreciated! 🙂
Russ
Solved! Go to Solution.
Hi @RZTidwell ,
I'm attaching an example showing how to use the command line to erase unwanted files.
https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Tool-Mastery-Run-Command/ta-p/31548
https://www.theinformationlab.co.uk/2017/08/10/delete-files-alteryx-cleaning-computer-part-1/
Let me know if this works for you.
Best,
Fernando Vizcaino
Hi @RZTidwell
Implement this logic in your macro.
Use a Sample tool to select the first row of each file. Filter for the ones that start with "Line items". Join back on Filename. This will have the effect of filtering out all the rows from the files that don't have "Line items" as the first line
Dan
Thanks Dan! This does what I needed.
Russ
Thanks Fernando. I don't necessarily need to delete the extra files, but this just opened up some new possibilities that I hadn't considered before.
User | Count |
---|---|
106 | |
82 | |
70 | |
54 | |
40 |