Page 1 of 1

Error Catch in FTP Batch

Posted: 02 Sep 2010 14:17
by SteveE
I have a simple batch file that runs 4 functions and sends some files via FTP to our server
1: collects any of file type *.swy from drop point
2: FTP them to Server
3: Copies files *.swy to backup directory
4: Deletes files *.swy from Drop Point

I need to error catch if the files being FTP’d and not, so that they don’t get deleted from the drop point until ftp’d

Here is my batch file: (this runs fine as is just need to capture should Myserver be down etc)

cd \\Test\db\CFS\WWICFPods
ftp -s:\\Test\db\CFS\WWICFPods\Script.txt
copy \\Test\DB\Cfs\WWICFPods\*.swy \\Test\DB\Cfs\WWICFPods\bak
del \\Test\DB\Cfs\WWICFPods\*.swy
y

======================================================================
Here is the FTP Script.txt file

open
Myserver
MyLogon
MyPassword
CD /cluster/cfs/u/cim3/outray/filedrop
PWD
ascii
prompt
mput \\Test\db\CFS\WWICFPods\*.swy
bye

any help / advise appreciated

Re: Error Catch in FTP Batch

Posted: 02 Sep 2010 19:31
by ghostmachine4
Win32 ftp is not really a good ftp client to do automation. Use a good programming language like Perl/Python that have FTP libraries with capabilities for error debugging and trapping. Eg of Perl's Net::FTP

Re: Error Catch in FTP Batch

Posted: 05 Sep 2010 14:38
by SteveE
Thanks for the advise but I am stuck with the basic cmd FTP tool
if you are saying I have no options in this are then thanks for your time, I will just have to manage without error catching
Steve

Re: Error Catch in FTP Batch

Posted: 05 Sep 2010 18:54
by ghostmachine4
you may want to try the -d switch for debugging.... that's about it i can recommend.