Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Dynamic Create File Directory

Is there a tool to dynamically create a new file directory on the hard drive (or network drive); whereby the file directory name would be a field in the incoming data, and the file would be a report coming from the Render tool?


I’ve used the command prompt tool to create directories (MKDIR) but never been able to use dynamic naming.

Alteryx Certified Partner
Hi Patrick,

I use the Run Command tool for this. In a formula tool before the Run Command, I make a field the will be something like this: "MKDIR " + [DirectoryField], I then remove all other fields and feed that into the Run Command tool to make a batch file (Write Source/Output) and run that batch file (Run External Program). You can use Block Until Done to make sure that your folders are created before saving to that directory. 


Can someone post a working example of this configuration?


I'm trying to use Run Command to create folder but I'm getting "Either an Output connection or Input connection is required" 


When I specify ma *.bat file in Output it says the format is not known

Alteryx Alumni (Retired)

Attached is an example that allows you to enter different folders and requires a full path


  1. Text input that has the path to the folder in a field called "DIR", in my case I entered the field value as D:\mytest.
  2. Formula tool to write a command for a bat, this is allowing me to run the second batch with different parameters (there are a lot of ways I could approach this).
  3. Run tool outputs the batch file to run and then configure to run it, attached to the Run tool is another batch that actually does the mkdir, the input is a log that shows whether the directory was created or if the directory already exists.

Let me know if this works for you.


What is the command within your "folder.bat" file ? 

Alteryx Alumni (Retired)

You would use the following command to run it:


folder.bat c:\temp\MyFolderName

The batch script contains the following where %1 is the first input from the cmd line:


@Echo off
IF EXIST %1 ( ECHO Folder exists > folder.log) ELSE ( MKDIR %1 && echo Created folder > folder.log )

Thanks a lot for your prompt reply. That was very helpful. 


I got the sample workflow to work, but for some reason when I plug that to my other workflow, the run_mkdir.bat has the command inside quotations and is not doing anything.


for example: "folder.bat C:\myDIr\Test" 


When I run the snippet as is in a separate workflow; there is no quotations " " so it is working and creating the folder. Any idea what I might be missing?


Actually I want to create a folder for today's date using DateTimeToday()


I got this. The delimiter was set to zero and so it was messing things up. Its all good now. Thanks.