Alteryx Designer Desktop Discussions

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

How to create a folder, if its not existing already

vencric
8 - Asteroid

How to create a folder, if its not existing already

36 REPLIES 36
Qiu
21 - Polaris
21 - Polaris

@vencric 
Not sure it is really an alteryx question. 😂

0302-vencric.PNG

vencric
8 - Asteroid

Hi Qiu, Thanks for the solution,. I m facing below error 

vencric_0-1646201641976.png

 

vencric
8 - Asteroid

Also the folder will vary depending on the name, coming from formula tool dynamically

Qiu
21 - Polaris
21 - Polaris

@vencric 
It did not happen to me as for the error, are running the flow from a remote location?
I am sure your have the %temp% as environment variable.
For the path, we can of course blend into the formula.

 

vencric
8 - Asteroid

No.. Not running from remote location and also included %TEMP%

vencric
8 - Asteroid

hi @Qiu , i am able to create folder in my local machine.... but when i'm trying to create in sharedrive, im getting this error

Pravallika20
8 - Asteroid

Hi @vencric ,

 

You can drag a python tool and add the following Python code:

 

from ayx import Alteryx
from os import makedirs
from pandas import DataFrame
df=Alteryx.read("#1")
path=df["path"][0]

try:
makedirs(path)
except OSError:
message_log = {"MessageLog" : "Failed creation of the directory " + path,"FolderCreated" : 0,"Path":path}

else:
message_log = {
"MessageLog" : "Successfully created the directory: "+ path,"FolderCreated" : 1,"Path" :path}
output_df = DataFrame(message_log,index=[0])

Alteryx.write(output_df,1)

vencric
8 - Asteroid

Hi @Pravallika20 ... i faced error while runinng it... is it possible to create a folder in network drive

Pravallika20
8 - Asteroid

Hi @vencric ,

 

You can create the folder in network drive. Can u tell me the error u are facing

Labels