Automating FTP.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
samuel_inba
Posts: 2
Joined: 23 Feb 2009 06:19

Automating FTP.

#1 Post by samuel_inba » 23 Feb 2009 06:26

Hi,
I am new to Dos programming ...
can any one provide me a test code which will automate the process of FTP (putting file to a server).

The script needs to get User name/ pwd and the source file name and destination file name.

if there are multiple files that need to be put to the server the above process should go in a loop untill the user wants to quit.

Pls hlp.

Thanks in advance.

RElliott63
Expert
Posts: 80
Joined: 04 Feb 2009 10:03

#2 Post by RElliott63 » 23 Feb 2009 10:29

You could start with something like...


Code: Select all


Cls
Set /P User=Enter UserID:
Set /P Pwd=Enter Password:

Echo Open xx.xx.xx.xx         > %Temp%\FTPScript
Echo User %User% %Pwd%       >> %Temp%\FTPScript
Echo CD \DestFolder          >> %Temp%\FTPScript
Echo LCD \SourceFolder       >> %Temp%\FTPScript

:GetAnotherFile

  Set /P SName=Enter SOURCE File Name:
  If /I [%SName%] EQU [Quit] Goto FTPJob

  Set /P TName=Enter TARGET File Name:

  Echo Put %SName% %TName%   >> %Temp%\FTPScript
  Set "SName="
  Set "TName="
  Goto GetAnotherFile

:FTPJob

ftp -n -s:%Temp%\FTPScript  > %Temp%\FTPJob.Log


You could then view the FTPJob.Log file to see if everything transferred without errors.

samuel_inba
Posts: 2
Joined: 23 Feb 2009 06:19

#3 Post by samuel_inba » 04 Mar 2009 05:05

Hi,
Sorry for the delayed response. Thanks for you reply. It solved my issue.Thanks a Lot. :D
Last edited by samuel_inba on 04 Mar 2009 05:06, edited 1 time in total.

Post Reply