Hi,
I want to make directories based on an excel file i read in.
CMD formula =
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
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.
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
is it possible to do without a python solution?
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 :)
Hi @wonka1234 , I know this post is old now - but did you ever find a solution?
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.