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
Asteroide

How to create a folder, if its not existing already

36 RESPOSTAS 36
Qiu
21 - Polaris
21 - Polaris

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

0302-vencric.PNG

vencric
Asteroide

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

vencric_0-1646201641976.png

 

vencric
Asteroide

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
Asteroide

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

vencric
Asteroide

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
Asteroide

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
Asteroide

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

Pravallika20
Asteroide

Hi @vencric ,

 

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

Enquetes
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Rótulos