Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Copy several files from directory to a new location and change file type

kellyreburn
7 - Meteor

I am trying to copy SPSS files from one folder into another folder as .csv files. I have several thousand files I am trying to copy and change. How can I do this using alteryx? I have been able to to it using the input and output tools with individual files. Is there a way to do it with several files at once?

 

 

8 REPLIES 8
Claje
14 - Magnetar

Knowing nothing about SPSS files...

 

You could replicate the process you used for an individual file by creating a batch macro.

You could use a Directory tool to point to your input location and find all the files, and then use a batch macro which reads in a file and then outputs it to the new location.  This would be pretty simple to set up (I've attached an example of what i mean that will look for CSV files).

You will need to right click the second tool in the workflow to open the macro and configure the information for a SPSS file, as well as the output tool.

Then you will want to update the path and file name criteria for the Directory tool in the main workflow.

kellyreburn
7 - Meteor
Thanks! I am trying this with .csv files now. I am getting an error with the input tool n the batch macro "file not found." I haven't changed it from what you had in there. Do I need to change that too?
Claje
14 - Magnetar

It will remove the initial error you are getting, but is not necessary, as it will be replaced entirely by the batch macro when it is run.

kellyreburn
7 - Meteor

It is not copying all .csv files. It is only copying over one, not sure how it is choosing it and then naming it "output." Is there a way to keep the file names? And why would it only be copying 1 file?

Claje
14 - Magnetar

Sorry, for some reason I didn't see notification of this until now!

You will probably want to change the Input tool configuration inside the batch macro so that it has the option to "Output File name as field".  Then, you can check off the box at the bottom of the Output Data tool that says "Take File/Table Name from Field", and select the option "Change File/Table Name".  Select the "Filename" field from the dropdown and deselect the "Keep Field in Output" checkbox.


That should make it so that it outputs each file as you expect.

kellyreburn
7 - Meteor

Awesome, thank you! That worked!

kellyreburn
7 - Meteor

is there a way to add in a change file name to this same macro?

ignas
8 - Asteroid

Hey @kellyreburn and @Claje 

 

Could any of you load an example file? I cannot understand how you can copy multiple files with the provided workflow. I tried to do what you wrote in comments, but nothing worked.

 

Regards,

 

Ignas

Labels