Alteryx Designer Desktop Discussions

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

Configure Run Command tool to move a file

AndrewW
11 - Bolide

I have a number of files in a directory, some of which I'll process, some of which I won't, but all YXDBs. Once all of the files I want to process have been processed then I want to move them to a different directory (or maybe delete, still TBC). I can do this using the command prompt.

 

The difficulty I'm having is how to run the command prompt, how to configure the Run Command tool. Apparently it needs either a Write Source or Read Results, I can't think what these could be to run a command in the command prompt.

 

I'll actually be generating the list of files to move into a list and am comfortable using a macro to alter the Command Arguments to dynamically load the command line details. What I don't know how to do is to get actually get the Run Command configured.

 

Note I've seen this prior question on a similar note, http://community.alteryx.com/t5/Data-Preparation-Blending/Using-Run-Command-to-Move-files/m-p/8958, but I prefer to do the Run Command mid-workflow and not use the Events if possible.

 

 

Frustratingly I'm unable to upload my 19kb screen shot of the current Run Command configuration so to describe I have entered "cmd" in the Command section and the correct arguement in the Command Arguments [Optional] section, which gives the error "Either an Output connection or Input Connection is required"

 

 

20 REPLIES 20
AndrewW
11 - Bolide

You could pull all of the seperate files into Alteryx and merge them (I assume you mean union them together) using a standard Input tool.

ronh_allaboutgis
6 - Meteoroid

Thanks Andrew,

 

Yes, ideally was hoping save a step and not have to do this...

 

Ron

AndrewW
11 - Bolide

The >> should output (append) to the same file, as long as it's in the same directory. http://ss64.com/nt/syntax-redirection.html

DultonM
11 - Bolide

Thank you @s_pichaipillai for explaining how batch commands can be made AND ran in a single Run Command tool!

 

For those of you who came to this post to learn how to DELETE a file with the Alteryx Run Command tool, you can follow the exact same mold that @s_pichaipillai provides here, but change the Command field in the Formula to be: "DEL"+" "+[SourceFile]

 

I couldn't get the log part to work (the "> "' + [Engine.TempFilePath] + '\MoveCommand.txt"') so that is why I removed it from the above formula. Without any text file being created by the batch file, you will also need to clear the "Read Results [Optional]" configuration option in the Run Command tool.

 

Once you've made the above 2 modifications, the Run Command Tool should delete the [SourceFile]!

 

Important Notes:

1) If your [SourceFile] has any spaces in it, you will need to surround it with quotes. AKA use the Formula "DEL"+" "+'"'+[SourceFile]+'"'

2) Make sure you define your strings in the Formula tool to be long enough!

svora2
5 - Atom

Hi All,

 

I have not used the Command Prompt tool before and am struggling to move my input file to another folder after the process completes.

I have attached the workflow - any insight / steps would be very much appreciated!

AndrewW
11 - Bolide

You attached some data in a spreadsheet.

 

My recommendation is to work through this article which explains how to move a file in Alteryx using Run Command.

 

If any of the steps aren't clear please let me know.

svora2
5 - Atom

oh, how silly of me! I have attached the test workflow and will also look into the link you sent. I am not sure how to set up the command prompt tool and I think that is the issue.

jnans
8 - Asteroid

Have you been able to do this as a batch process with multiple files? I have two directories that I reach in and union the directory as 1. I then want to move all files in both directories to one output folder. I want everything to keep its same name just be moved so that the original files are empty. I am getting very stuck with this even though it appears it should be a somewhat easy process

roshnimehra870
5 - Atom

I have been trying to configure the Run command but i get below error:

 

Run Command (14) The field "Cmd3" is too big (1073741823 bytes) for a flat file. The limit is 64K.

roshnimehra870_0-1635953121573.png

 

roshnimehra870
5 - Atom

i configured my run command exactly as you did but i get error:

Run Command (14) The field "Cmd3" is too big (1073741823 bytes) for a flat file. The limit is 64K.

Any help would be appreciated

roshnimehra870_0-1635953267129.png

 

Labels