ANSI Standard PL/B Language and Visual PL/B
FTP from PL/B
FTP Processing from PL/B
We need the ability to process files via FTP from our PL/B programs. The suggestion from the Sunbelt forum was to use the FTP.exe
Here's an example posted by Mike Maynard in May 2010.
John Shrimski offered this link for more information:
FTP Command List
FTP Example: Works on Windows XP, Vista, and Win7 and transfers an ASCII text file to the FTP host with the hash option to give a visual cue to the transfer progress. Logs to Logfile.log
@Echo FTP send filename.OUT to FTP Server at ftp.host.com >> Logfile.log
ftp -n -s:"ftpscript.ftp" ftp.host.com | FIND "Transfer complete" >> Logfile.log
if ERRORLEVEL 1 goto :FTPError
@Echo "ftpscript.ftp completed successfully" >> Logfile.log
@Echo "ftpscript.ftp failed" >> Logfile.log
Script file: ftpscript.ftp
On Aug 10, 2011 David Herrick started this thread on the Sunbelt board:
For years we have been making API calls to CuteFTPro
from plb to automate data transfer to and from clients and vendors.
Have a database of sites, user ids, passwords, local and remote directories associations, file types, etc.
This has worked well until recently the job moved to different machines. first move was to virtual machines that are clones of the working XP physical boxes - One worked as expected one failed on some sites, all settings look correct. next clean install on WIN 7 different set of sites don't work - argh.
How are others automating FTP?
I've been using CUTEFTP
also, and it seems to be ok, but the per-workstation cost is a killer. We have sites with over a hundred workstations in different sites that all need to do FTP, and there is no central processing.
I found a control that has both a COM and GUI version; supports FTP, SFTP and FTPS and costs just a little over $200. It is royalty free.
I have been wanting to evaluate whether it is something we can program against in PL/B, but since the examples are in VB, I think it’s a good bet we can.
Distribution is royalty free.
FTP com component
I had to do this a few months back. After looking at several alternatives including CuteFTP
, I ended up using the standard Windows FTP client. Tested on Win2K, XP and WIN7 ok.
Simple, cheap, bulletproof.
1. Write a script file with the ftp commands you want to process - e.g. a file called ftpxfer.txt with:
open ip address or fq domain
ascii (if you want to transfer a text file)
file stuff (get, put, append whatever)
From your program, do something like:
execute "!ftp -s:c:\someDirectory\ftpxfer.txt"
So, you're simply passing the name of the ftp command file your program has written to the ftp client. Of course if you're sending stuff, it presupposes you've written the data to a file in the 1st place.
If you need a secure connection then WinSCP is quite good - works in much the same way by passing it a script name.
I have been using the approach you have outlined for a few years now .... on all versions of Windows.
It is cheap and it works.
John Shrimski, Chai Holdings Pty Ltd
For some strange reason, when confronted with simple vs complex, I usually end up with complex Quite why this is, I don't know. In this (rare) case, I ended up with simple. I must be getting old...
anyway to capture errors???
David L. Herrick