Alteryx Designer Desktop Discussions

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

Create Folders and Sub folders in it

mohit9garg
8 - Asteroid

Hi,

 

I have very huge data which I want to segregate and save in multiple files. 

 

Same Data

 

CountryCityPersonAgeIncome
IndiaDelhiRam281000
IndiaDelhiSita27900
IndiaDelhiMohan29980
IndiaMumbaiMohit30950
IndiaMumbaiMisha70
AustraliaSydneyMark20200
AustraliaSydneyJohn18150
AustraliaPerthMicheal455000
AustraliaPerthEric382500
AustraliaPerthColette15350
AustraliaMelbourneIsable21600
USNew YorkMark26750
USWashingtonJack29800
USWashingtonMike24500
USSeattleSimon363500
USSeattleJack414700
USChicagoKelvin27550
USChicagoImran331100
USChicagoAndy55650

 

First I want to create folder with "Country" name. Each "Country" folder should have sub-folder with "City" names. Then each sub-folder should have Files with "Person" name. Like below-

 

mohit9garg_3-1614311675806.png

 

Kindly help me in creating a workflow for this.

 

Regards,

Mohit

 

@patrick_digan 

 

20 REPLIES 20
Emil_Kos
17 - Castor
17 - Castor

Hi @mohit9garg,

 

Did you manage to make it work?

If yes can you share how did you make it work?

mohit9garg
8 - Asteroid

@Emil_Kos I used batch Macro provided in this discussion-

 

https://community.alteryx.com/t5/Alteryx-Server-Discussions/Folder-Creation/td-p/441689/highlight/fa...

 

Though I raised a supplemental question too. Please see if you can resolve.

 

Thanks,

Mohit

Emil_Kos
17 - Castor
17 - Castor

Hi @mohit9garg,


I have replied to your post.

 

https://community.alteryx.com/t5/Alteryx-Server-Discussions/Folder-Creation/m-p/724458/highlight/tru...

 

I think the error your receive is related to folders that already exist. Maybe you can remove them as the first step of the workflow? 

mohit9garg
8 - Asteroid

@Emil_Kos Thanks for your help so far.

 

In Output tool, I selected below option which overwrite the previous file and this solved my problem.

 

mohit9garg_1-1614416209645.png

 

However can we switch off that error, i-e workflow should ignore the error and proceed further.

 

 

 

 

 

 

Can you please amend the batch macro

Emil_Kos
17 - Castor
17 - Castor

Hi @mohit9garg 

 

apologies but I don’t have access to my pc. I am not sure when I will be able to take a look.

mohit9garg
8 - Asteroid

No rush sir @Emil_Kos 

 

whenever you have sometime.

Emil_Kos
17 - Castor
17 - Castor

Hi @mohit9garg,

 

Apologies but I was thinking about what would be the best approach for this. 

 

The easiest solution for me was just deleting all the old folders. You don't need them anyway and that way you will ensure that you will not get any errors.

 

Emil_Kos_0-1614452908451.png

 

The alternative solution that I was thinking of would be much more complicated. I was thinking about using the directory tool and make sure that I am creating only new files for the files that didn't exist and overwrite files for each xlsx that already exists.

 

I think it is just easier to delete everything and save the files once more. 

 

Hope this will help you!

 

mohit9garg
8 - Asteroid

Thanks Much @Emil_Kos This is a wonderful solution. I was looking for it for such a longtime (but for other workflow)

 

But for this one, I am more inclined towards using the batch macro as it is solving my "space in folder name" issue. But Can you help me in amending the batch macro a bit. I am getting below error if I delete the original macro & files from my download folder. Is it mandatory to keep those files. (Kindly excuse my ignorance, I have zero knowledge about macros 😞

 

mohit9garg_0-1614487460907.png

 

 

 

Emil_Kos
17 - Castor
17 - Castor

Hi @mohit9garg,

 

You need to save this macro in this location:

Emil_Kos_0-1614506459116.png

 

Just open the macro and click save as and save in the location from the previous screen: 

 

Emil_Kos_1-1614506560988.png

 

Later you can export the workflow as a package in order to share it without any problems. Thanks to that the workflow will be embedded inside the workflow. 

 

Emil_Kos_2-1614507055443.png

 

Please let me know if this helped? 

 

pcatterson
11 - Bolide

Would I need administrator access to my computer to do this?

 

I am running your macro and its giving me an error that I'm assuming is related to my access: 

 

"Error: Run Command (2): The external program "cmd.exe" returned an error code: 1"

Labels