Alteryx Designer Desktop Discussions

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

Creating Folders using run command. Do not Overwrite existing folders

wonka1234
10 - Fireball

Hi,

 

I want to make directories based on an excel file i read in.

 

wonka1234_0-1668007141071.png

 

CMD formula = 

wonka1234_1-1668007193619.png

 

A sample record in my "CMD" field is  "folder.bat ALTERYX-2023-0704-2225--"

 

I want to create this field as a folder in a specified location.

 

Then I try to use the run command tool to write these folders to my location

wonka1234_4-1668007557841.png

 

 

 

 

contents of my folder.bat file:

 

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

 

 

 

I am getting an error. The file folder.bat is not a known format.

 

What am I doing wrong here?

 

 

Note - I eventually want to put this on the server and write new directories in intervals. I dont want to overwrite existing created folders.

5 REPLIES 5
Felipe_Ribeir0
16 - Nebula

Hi @wonka1234 

 

About your problem with the CMD, i cannot help much. But about your main problem (create directories if not they do not exists), you could use this another option with python that works very well.

Create directory if not exists and save the ouput - Alteryx Community

wonka1234
10 - Fireball

is it possible to do without a python solution?

Felipe_Ribeir0
16 - Nebula

Hi @wonka1234 , it is indeed! If you dont want to use python, let`s see if someone come to help with the CMD way of doing :)

j_bird
5 - Atom

Hi @wonka1234 , I know this post is old now - but did you ever find a solution?

apathetichell
19 - Altair

Nothing wrong with the strategy - the issue is that folder.bat should be the executable - so 

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

should write a file called folder.bat

it should be the only field sent to the output part of the run command - which should be set to \0 delimiter - quote mode - never, do not write fieldnames.

folder.bat is the executable which should run as well.

 

my hunch is the poster realized the error was not in the strategy but something about the folder.bat or invoking folder.bat.

 

fyi - you should test the .bat file after running in your command prompt - see if it generates an error there as well.

Labels