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
fharper
12 - Quasar
  1. try writing an explicit path without using environment variables. get your script working, then change the path to a dynamic one if you want by using variables.  should not need python but if you are python savvy have at it but Command line or Powershell are my usual choices for a simple task like this. 
  2. if you have an issue creating the folder on a shared drive with explicit path the error is likely to indicate a permissions problem, you may have read or read/execute but not modify or create permission to the parent folder you want to build this folder in

 

vencric
8 - Asteroid

hi @fharper  how to concatenate values in same rows till blank value is found

fharper
12 - Quasar

@vencric , you should not embed multiple problems within same thread.  It becomes impossible for others to follow and to search for answers. 

 

the info in this thread should be specific to the original issue "How to create a folder, if its not existing already".

 

about 2/3rds of the way through the second page of responses the discussion jumps track to a different problem with discussion around using regex and other things to determine and respond to a condition.  At least it seems to be a leap to a different subject.  

 

Also we do not see anything marked as a solution...so was your original problem of dynamically creating a folder when needed resolved and if so then please mark that reply as the answer so others with the same problem can find it.  

 

I suggest creating a new thread for the other issue so it can be searched and a solution, assuming there is one, can be identified by others searching.  you might ask one of the moderators to do this for you.  I know they used to do that when they notice multiple issues in a single thread.

fharper
12 - Quasar

@vencric "how to concatenate values in same rows till blank value is found" should be title or subject of a new thread.  and in regards to that clarify if this is concatenating multiple columns/fields on a row or multiple substrings within a field, which is really more a parsing question. 

The statement is generic enough it could be taken either way or both which can  lead to very different solutions.

Provide as much detail as possible so others who seek to help will have minimal questions and can quickly provide good ideas.

vencric
8 - Asteroid

How to concatenate value in same row, till blank value is found. Ex.

@fharper @atcodedog05 

Input:

 

Level   Prefix    Base         Concat

0          JH          1000  

1           KB         1001        KB-1001

2           BC         1002        BC-1002

1           CD         1003        CD-1003

0          AB          1004

1          AA          1005          AA-1005

 

Output:

 

 

Level   Prefix    Base         Concat                 OP

0          JH          1000                                     KB-1001;BC-1002;CD-1003

1           KB         1001        KB-1001

2           BC         1002        BC-1002

1           CD         1003        CD-1003

0          AB          1004                                     AA-1005

1          AA          1005          AA-1005

 

Nonsensely
7 - Meteor

This thread has me totally lost?  It appears that rather than creating a dynamic folder name, these responses are parsing data and slinging all over the place.  Can someone please walk me through something like this:

 

1. Period = 2022-08 (or 2022-07, 2022-09, etc.)

2. Line = L1 or L2 or L3, etc. 

 

Current path = c:\documents\Alteryx\

 

I'm pulling data for August of 2022.  If folder "2022-08" doesn't exist, create a folder named "2022-08".  

Place files "L1" (or L2, or l3, or whatnot) into folder "2022-08".

 

I can get the dynamic file name to work by using the "line" field, creating one file for each Line, but since there is no folder called 2022-08, it's blowing up.  I'm using a dynamic path with a formula called "Path"  -  'c:\documents\alteryx\' + [period] + '\' + [line] 

 

If the folders are pre-created it works fine with finding the correct folder and writing the correct line, it just won't create a folder. 

 

Szymon_Czuszek
7 - Meteor

I think you need quotes around both full paths, not only in "if not exist" command. Example: 'if not exist "' + [Directory] + 'Output\" mkdir "' + [Directory] + 'Output\"'

Labels