We have extended our Early Bird Tickets for Inspire 2023! Discounted pricing goes until February 24th. Save your spot!

Alteryx Designer Discussions

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

Creating a Dynamic Directory by linking a Formula Tool to a Directory Tool

8 - Asteroid

I want to create a dynamic directory tool in order to look if 3 unique files exist within a folder each time I run the workflow. I've read a handful of Dynamic Directory discussion posts and none of them seem to really to solve my issue without an app or macro. I have a tool container that has our company's special accounting calendar that feeds the current period information into a formula tool where I put together the file path I would want to then feed into a "dynamic directory" tool.


The dynamic directory will change from:


\\Accounting\JE Backup\2019\P10\P10-19\




\\Accounting\JE Backup\2019\P11\P11-19\




\\Accounting\JE Backup\2020\P01\P01-20\


Does anyone have any suggestions for trying to achieve this without making a macro or an app? If it must be in a macro or app, can you provide an example of the workflow where you are able to pass this path from a formula tool into a parameter or similar interface tool?

15 - Aurora

Hey @taxguy33 


It has to be a macro!


You can use mine as a starting point if you wish....


It requires 3 fields, the file path, the file spec and whether to include subdirectories (which is a bool)



8 - Asteroid

@LordNeilLord  Thanks for the starting point, but I'm really grasping at straws for how I could feed values like the year (e.g., 2019 currently, but 2020 in a few months) and the period number (e.g., P11 right now, but P12 in a few weeks) into the directory tool. 


Can I connect my formula tool to any of those Control Parameters or Action tools to feed in the fields for year / period into ultimately the directory tool? Otherwise I'm only seeing movement in this macro by manually editing the Directory, File Specification, and include subdirectories fields within the connected Directory Tool. Am I missing something?



ACE Emeritus
ACE Emeritus

One alternative to the directory tool is to use the RunCommand to create a file list:




In this flow, you can get a dynamic driven file list. Basically it creates a temporary batch file which does the directory listing command.

8 - Asteroid

Hey @jdunkerley79 not sure if this is what OP was looking for but it was certainly exactly the solution I was looking for. Thanks for this!!

8 - Asteroid

Hi @jdunkerley79 - I actually have another question about this... so I see that you're using the /b parameter for dir to call the bare list of directories and files, but I'm trying to figure out the syntax to also call in the creation date timestamp. I tried to use the following syntax: "dir /T:C"


What ends up happening is that Alteryx says there's too many columns, and I think I need to figure out a way to express delimiters or additional columns through the Run Command tool...


I essentially want to be able to reproduce what the Directory tool can do, but utilize the Run Command tool since the location of the directory is dynamically changing every time.