Alteryx Designer Desktop Discussions

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

Run Command Tool Returns Ambiguous Error

danilodrobac
7 - Meteor

Hi all

 

I'm attempting to use the run command tool to run a .bat file which will rename (move) multiple files on my FTP server. I've got to where I am by using the methodology explained in this article, but obviously with a different final product, and I'm getting an error returned saying:

 

Run Command (16)	The external program "./BatchFtp.bat" returned an error code: 2

 

I'm using Alteryx to download a list of FTP files that exist on my server, and once that's done (using the "Block Until Done" tool), move those files to the archive directory. Based on the same list of files that I download, I use Alteryx to create a file called ftpscript.txt, which compiles all of the code I need into a txt file, which I then use my as an argument in my .bat file.

 

BatchFtp.txt is:

 

ftp -s:ftpscript.txt

ftpscript.txt is:

 

open ftp.globalanalytics.16mb.com
user
password
rename "/Folder/file1.csv" "/Archive/file1.csv"
rename "/Folder/file2.csv" "/Archive/file2.csv"
rename "/Folder/file3.csv" "/Archive/file3.csv"
rename "/Folder/file4.csv" "/Archive/file4.csv"
disconnect
quit

 

Using my command prompt, I've tested the process by running the BatchFtp.bat file, and it successfully runs the script and moves the files on the FTP server, but for some reason, when I try to replicate this in Alteryx I get an error.

 

My "Run Command" tools is set up as follows, where I've just created a random temporary file as the output for "Write Source" just because there has to be something in there, and put the bat file in the command field.

 

Run Command Tool Setup

 

I can't come up with any logical reason why this isn't working. I'm hoping it's something really obvious regarding the tool itself which I seem to have missed.

 

Does anybody have any suggestions?

 

Thanks

Dan

11 REPLIES 11
Aguisande
15 - Aurora
15 - Aurora

Hi Dan,

The first thing I noticed is the Command with a forward slash not a backslash (.\BatchFtp.bat)

 

Can you attach a copy of the workflow you're using?

And more detail about the computer? OS language, version, etc...

I'm guessing it has something to do with permissions (mostly on temporary directories)

 

 I tried the attached sample I made (connected to a public FTP), and worked without problem.

 

 

danilodrobac
7 - Meteor

Hi Aguisande

 

I noticed that forward slash issue too and tried the other way round, it still returns the same error.

 

I've attached the workflow for you to take a look at.

 

I'm using remote desktop on a MAC to connect to my PC that lives under my desk. It's running Windows 7 64bit, English.

 

Thanks

Dan

 

 

danilodrobac
7 - Meteor

 

 

tom_montpool
12 - Quasar

What I see in your example is that your BatchFTP.bat file wants a file called ftpscript.txt but your Run Command output is creating a file called ftpscript.yxdb.

 

Also, in the Run Command tool, try using /c BatchFTP.bat as your command.

danilodrobac
7 - Meteor

Hi Tom

 

From my understanding, for the run command, either an output or an input is required to make the tool work, so I've just used ftpscript.yxdb as an obselete file that's created just so I can make the run command run my .bat file. The ftpscript.txt is actually created in the other part of the workflow (the first part of the "Block Until Done (22)"). I can't seem to make the output file for the run command be a .txt, that's why I've opted for this method.

 

I just tried the thing you suggested and get an error returned that says:

 

Error: Run Command (16): Failed to run external program "/c BatchFtp.bat": The system cannot find the file specified.

 

Aguisande
15 - Aurora
15 - Aurora

Hi Danilodrobac,

For What I tested from you workbook, all info gathered in the first part of the Workflow are Directories, So the Filter you have there ([Directory or File] Equals File) leaves the data stream empty.

From that point on, you have no data whatsoever.

 

BTW, I tried in my computer, and no errors thrown.

 

DirectoryOrFile.PNG

danilodrobac
7 - Meteor

Hi Aguisande

 

I think your browse tool is connected to the "False" part of the filter, hence why it's only showing directories. That filter is there to separate the files from directories and only deal with the files.

 

So your run tool is just kept the same as what it was in the workflow that I sent but it worked without errors? I have no idea what might be happening then... Do you have any suggestions?

Aguisande
15 - Aurora
15 - Aurora

No, the 0 corresponds to the T output of the Filter.

This is the data I receive from the Formula Tool and inputs into the Filter:

DirectoryOrFile2.PNG

 

And Yes, I run the workflow you attached, and the only thing I had to change was the H: in the [Directory] column of the Text Input (cause I don't have an H: drive in my computer)

 

Quick question: What language is the Windows installed on the machine you're accessing from your Mac?

danilodrobac
7 - Meteor

Ahh I see, that will be because you successfully ran the workflow which means all of the files successfully moved on the FTP server so when you re-run the flow, there's no more files to access.

 

I'm so confused why it would work on your machine but not mine.

 

English (United Kingdom) is the language setting.

Labels