Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.
SOLVED

Folder Creation

navnidhsinghsahni
7 - Meteor

Hi,

 

Is it possible to create folders with Space in the folder name using Alteryx? I am able to create folders using Run Command tool but the folder names can't have spaces between them.

12 REPLIES 12
MichalM
Alteryx Alumni (Retired)

@navnidhsinghsahni 

 

You just need to make sure that you wrap the name in quotes

 

mkdir "Folder Name"

 

navnidhsinghsahni
7 - Meteor

Hi MichalM,

 

When I enter a command say:

 

"mkdir"+"C:/Users/Desktop/New Folder"

 

It creates a folder named "New" at the destination path and the run command returns an error:

"The external program "..." returned an error code: 1".

 

So, I am unable to create folders which have spaces in their names.

MichalM
Alteryx Alumni (Retired)

Hmmm. That's strange. Do you want to built a .bat file with the command and execute that via the Run Command tool instead? I've tested with the below and it works

 

mkdir "C:\tmp\New folder"

 

run-command.png

 

navnidhsinghsahni
7 - Meteor

Yeah, running a pre-defined bat file via alteryx works.

 

But I want to overwrite a bat file with a folder name(Text Input) from the Alteryx Workflow.

I am doing that by creating a field called Command and feeding it to the Run Command Tool.

 

Command: "mkdir"+"Final Path" 

 

It returns the same error

MichalM
Alteryx Alumni (Retired)

@navnidhsinghsahni 

 

You could use a batch macro to pass the directory name into the Run Command tool as described by @patrick_digan  here.

 

Attached is an example he's built out. Let me know if it addresses your issue.

 

 

navnidhsinghsahni
7 - Meteor

This batch macro works perfectly. I am now successfully able to create a new folder with spaces between the names.

I figured out the problem I was facing. I was trying to create folders in the Shared Drive for a client.

So, there were some issues with the bat file but when I ran in the C:\ Drive, it worked perfectly. 

 

Thank you for your valuable suggestions!!!

sngoh55
5 - Atom

Hi, so are you not able to create folders in a shared network folder? If so I'm in trouble. I want to create my app in their private alteryx server and create folders for my outputs as part of the workflow based on time of the run.

MichalM
Alteryx Alumni (Retired)

Depending on what your output file is, you could use the Render tool to dynamically create a folder for you. 

 

What is the file format you'd like to write? 

sngoh55
5 - Atom

I'm just looking to output xlsx and csv files in the folder. I understand I'll need to use the block tool to create the folders first but not sure what else to do.