Go Back   PCMech Forums > Help & Discussion > Internet, Web Applications, & The Cloud

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 12-06-2002, 08:46 PM   #1
Member (1 bit)
 
Join Date: Dec 2002
Posts: 1
Automate FTP

I am Trying to write a batch file to automatically connect to a FTP site, and copy a file to my C:\
Can anyone tell me how to do this?

confused:
Lina is offline   Reply With Quote
Old 12-08-2002, 07:45 AM   #2
Member (9 bit)
 
Great_One's Avatar
 
Join Date: May 2000
Location: Lexington, Michigan
Posts: 353
bat file: i'll assume windows

basically you want to run the ftp command from the batch file.
but you also want ftp to run a command file which contains the
ftp commands you want to run

here is the syntax for ftp command line:

FtpTransfers files to and from a computer running a File Transfer Protocol (FTP) server service such as Internet Information Services. Ftp can be used interactively or in batch mode by processing ASCII text files.

Syntax
ftp [-v] [-d] [-i] [-n] [-g] [-s:FileName] [-a] [-w:WindowSize] [-A] [Host]

Parameters
-v
Suppresses the display of FTP server responses.
-d
Enables debugging, displaying all commands passed between the FTP client and FTP server.
-i
Disables interactive prompting during multiple file transfers.
-n
Suppresses the ability to log on automatically when the initial connection is made.
-g
Disables file name globbing. Glob permits the use of the asterisk (*) and question mark (?) as wildcard characters in local file and path names. For more information, see Ftp: Glob.
-s:FileName
Specifies a text file that contains ftp commands. These commands run automatically after ftp starts. This parameter allows no spaces. Use this parameter instead of redirection (<).
-a
Specifies that any local interface can be used when binding the FTP data connection.
-w:WindowSize
Specifies the size of the transfer buffer. The default window size is 4096 bytes.
-A
Logs onto the FTP server as anonymous.
Host
Specifies the computer name, IP address, or IPv6 address of the FTP server to which to connect. The host name or address, if specified, must be the last parameter on the line.
/?
Displays help at the command prompt.


pay attention to the -s command

so at a command prompt your bat file would run

ftp -s:c:\transfer.txt (or whatever your file name is.)

in the transfer.txt file, you would have your ftp commands like:

open "hostname" (or ip address)
user "username"
pass "password"
get "name of file"
exit

best way to create the file is run the ftp program manually and write down the commands needed to transfer the file and put them in the text file
__________________
Certifiable
===========================================

Cisco CCNA,CCDA
CompTIA A+, Network+,Inet+,Security+
CIW Associate
IBM AIX certified
IBM Certified Specialist - p5 and pSeries Administration and Support for AIX 5L V5.3
IBM Certified Systems Expert - p5 and pSeries Enterprise Technical Support AIX 5L V5.3
Great_One is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:07 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2