View Single Post
Old 08-19-2008, 02:43 PM   #1 (permalink)
ihatecats
 
Newb Techie

Join Date: Aug 2008

Posts: 1

ihatecats is on a distinguished road

Question FTp using windows bat file and checking status

Hi,
I am trying to write a Windows batch command file to ftp (only upload) some files to a server.

But I also need to check if each upload is successful or not and display that information in a log file (only if failed)

For that I have created a text file and the following BAT file. I am not exactly sure how to check the status (success/fail) of each upload. Any help would be greatly appreciated.

Here is what my .txt file and .bat file looks like.

Thanks,



FileTransfer.txt

myuserid
mypassword
cd /my/target/directory
lcd local
lcd uploadfrom
binary
mput *.gif
bye



UploadFile.bat

@ECHO File upload started at %TIME%>ftp1.log

ftp -i -s:FileTransfer.txt myhost>>ftp1.log


@ECHO File upload ended at %TIME%>>ftp1.log

@echo off
if %errorlevel% >= 0 (echo Files upload Failed
) else (echo Files upload Successful)
:EOF

pause
ihatecats is offline