We post different small ASCII-Files regularly on a ftp-server of our partners. Today the macro-scheduler-log file showed a correct FTPputFILE, but our partner didn´t receive the file. But our local macro continued to work and marked the file as "done". Of course our partners did not continue the work process! Bad luck.
To prevent this damage in the future I want to interpret the ReturnCode of the FTPputFILE-command. How can I do this?
thanks for your advice
wolfgang
Check Return Code on FTPputFILE
Moderators: JRL, Dorian (MJT support)
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
To confirm uploads with FTP, I have done a Directory listing of the FTP Server site after the upload and check for uploaded file. Here is an excerpt:
Label>Upload
//Upload file to FTP site
FTPPutFile>%FTPServer%,%FTPUser%,%FTPPW%,21,%ftpfilename%,%filename%,I
//Confirm upload to FTP
FTPGetDirList>%FTPServer%,%FTPUser%,%FTPPW%,21,%WorkDir%\FTPDir.txt,%filename%,L
Let>ftpfilesize=0
FileSize>%WorkDir%\FTPDir.txt,ftpfilesize
If>%ftpfilesize%>0,UploadOK
MessageModal>File not uploaded
//Loop for 5 attempts.
//...
Goto>Upload
Label>UploadOK
MessageModal>File %ftpfilename% was uploaded
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Using FTPGetFile afterwards also helps
Hi,
I did not know about the FTPGetDirList-command - but it´s very nice to see that you had quite a similar idea to create a return code yourself. So the possibility to check the return code of the ftp-command would surely be helpful. But without this: since we upload numerous files and I have to check each file separately I did the following script:
------------------------------------------------
FTPPutFile>%cctop_server%,%cctop_user%,%cctop_pw%,%cctop_port%,%from_pathfile%,%cctop_pathfile%,%ftp_mode%
Wait>2
;
; check the success of the previous put
;
FTPGetFile>%cctop_server%,%cctop_user%,%cctop_pw%,%cctop_port%,%check_pathfile%,,%cctop_pathfile%%ftp_mode%
Wait>2
IfFileExists>%check_pathfile%,Success
;
; NO success
;
Let>MSG_STAYONTOP=1
GetDate>varDate
GetTime>varTime
LET>msg=The File %CRLF% %filename% %CRLF% was not found on ftp-server %CRLF% %varDate% - %vartime%
message>msg
Goto>EndOfLoop
;
; SUCCESS
;
Label>Success
...
-----------------------------------
This script is not very efficient since we do double transport via Internet. But up to now the file size is usually between 30 and 40 KBytes and I want to be very very sure that the file has been uploaded in time!
thanks for your Help Bob!
wolfgang
I did not know about the FTPGetDirList-command - but it´s very nice to see that you had quite a similar idea to create a return code yourself. So the possibility to check the return code of the ftp-command would surely be helpful. But without this: since we upload numerous files and I have to check each file separately I did the following script:
------------------------------------------------
FTPPutFile>%cctop_server%,%cctop_user%,%cctop_pw%,%cctop_port%,%from_pathfile%,%cctop_pathfile%,%ftp_mode%
Wait>2
;
; check the success of the previous put
;
FTPGetFile>%cctop_server%,%cctop_user%,%cctop_pw%,%cctop_port%,%check_pathfile%,,%cctop_pathfile%%ftp_mode%
Wait>2
IfFileExists>%check_pathfile%,Success
;
; NO success
;
Let>MSG_STAYONTOP=1
GetDate>varDate
GetTime>varTime
LET>msg=The File %CRLF% %filename% %CRLF% was not found on ftp-server %CRLF% %varDate% - %vartime%
message>msg
Goto>EndOfLoop
;
; SUCCESS
;
Label>Success
...
-----------------------------------
This script is not very efficient since we do double transport via Internet. But up to now the file size is usually between 30 and 40 KBytes and I want to be very very sure that the file has been uploaded in time!
thanks for your Help Bob!
wolfgang
Maybe you should have an additional look at the standard: FTP commands !
I guess a post file listing piped to a log.file should be save enough. That's what we're doing after pushing files to a customers server.
I guess a post file listing piped to a log.file should be save enough. That's what we're doing after pushing files to a customers server.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Hi Lumumba....
I was trying to provide an answer using the Macro Scheduler FTP commands, but you are reminding us that that we can also use
Run Program>command /c ftp commands.
Thanks for the reminder about FTP commands and the listing.
I was trying to provide an answer using the Macro Scheduler FTP commands, but you are reminding us that that we can also use
Run Program>command /c ftp commands.
Thanks for the reminder about FTP commands and the listing.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!