spacer
cornerspacercorner
Reply
Occasional Visitor
rolandmac
Posts: 1
Registered: 01-28-2012
0 Kudos

FTP File Transfer

Hi,

 

In v7 of Metastorm, I was able to execute a run command as follows:

%Run("FTP.EXE"," -s:C:\BATCH_FTP.SCR")

 

The .SCR file had all of the connection information as well as the file information that needed to be transferred.

 

In v9 I am sure something similar would be included, but I have been unable to find a similar Run command to perform this function. 

 

Any information woudl be appreciated.

 

Thanks,

Esteemed Contributor
Jerome҉
Posts: 744
Registered: 05-18-2010
0 Kudos

Re: FTP File Transfer

I'm no expert, but a quick search on Bing gives me:

 

 

                        string targetDir;

                        targetDir = string.Format(@"C:\Documents and  Settings\mmeuse\Desktop\CallBatchFile\BatchFile");

               

                        p.StartInfo.UseShellExecute = true;

                        p.StartInfo.WorkingDirectory = targetDir;

                        p.StartInfo.FileName = "MyBatchFile.bat";

 

                        p.StartInfo.Arguments =  string.Format("C-Sharp Console application");

                        p.StartInfo.CreateNoWindow = false;

                        p.Start();

                        p.WaitForExit();

 

 

Valued Contributor
Paul
Posts: 146
Registered: 05-19-2010
0 Kudos

Re: FTP File Transfer

I would avoid using a command shell unless you really have to.

 

For things like this I would use third-party components to add funtionality to a Metastorm solution. There are lots of good components available and you can probably get a suitable component for around $100.  You'll get the advantage of tighter integration with your Metastorm solution and the option of catching errors and delaing with them gracefully.

Employee
Tony Wheeler
Posts: 67
Registered: 05-02-2011
0 Kudos

Re: FTP File Transfer

[ Edited ]

HI Rolandmac,

 

The closest thing to the %Run command in 9.x would be to start a new (.Net) Process in C# in a server side script. For example, this should do the same thing:

 

System.Diagnostics.Process ProcFtp = new System.Diagnostics.Process();

ProcFtp.StartInfo.FileName  = "ftp.exe";

ProcFtp.StartInfo.Arguments = @"-s:C:\BATCH_FTP.SCR";

ProcFtp.Start();

 

I should mention that the best practice would be to write a server side script using the native .Net FTPWebRequest class as automating on the server is not recommended. If you choose to go this route, see this example, particularly the async() method: http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest(v=vs.90).aspx

 

Whatever you do, do not specify WaitForExit() on the ProcFtp or you will block execution of the running thread (the engine) until your file transfer is completed!

line spacer line
spacerFollow Metastorm on:
spacer Twitter YouTube Blog iTunes LinkedIn Metastorm Community Central, MC2
spacer Copyright © 2011 OpenText Corporation. All Rights Reserved.spacer About Metastormspacer Privacyspacer Legalspacer Site Mapspacer RSSspacer Contact Us
Microsoft Gold Certified Partner
Powered by Windows Azure
line spacer line