Question

Locked

How to check the return code for ftp in windows nt scripting

By anju.patel ·
Hi,
I have a windows script which ftp's the files from one location to another unix location
I need to check whether the ftp was successful or not.
How can I do the needful?
Here is the code

echo FTP to userevr - File Verification Started >>%LOGFILE%

IF NOT EXIST \rs_survey_result.txt GOTO DoNotFTP

IF NOT EXIST \rs_survey_error.txt GOTO DoNotFTP

IF NOT EXIST \rs_scheduled_survey.txt GOTO DoNotFTP

IF NOT EXIST \rs_scheduled_survey_set.txt GOTO DoNotFTP

echo FTP to userevr - All files are present >>%LOGFILE%


ftp -s:\FTPto.sh >>%LOGFILE%
echo %errorlevel% >>%LOGFILE%


echo FTP to userevr Completed >>%LOGFILE%
echo. |time |find "current" >>%LOGFILE%


code for FTPto.sh is as follows :-


open userver
test
teset12010
cd out
put \rs_survey_result.txt
put \rs_survey_error.txt
put \rs_scheduled_survey.txt
put \ rs_scheduled_survey_set.txt
bye

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Are the filenames always the same?

by robo_dev In reply to How to check the return ...

if so, then you would need to compare file dates or perhaps have another process that moves/erases the files when they are used.

if exist \rs_survey_result.txt goto yes
goto no
:yes
echo file exists
goto end
:no
echo file not there
goto end
:end

Collapse -

Read in the logfile

by Tony Hopkinson In reply to How to check the return ...

and check for the correct response code was the only way I ever trusted from shell scripting.
Passing back the ftp status status code as return (exit code) was always 'erm iffy in windows.

Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums