OSTU - Automating Microsoft FTP Client (by Tony Fortunato)


Published on

Tony Fortunato is a Senior Network Specialist with experience in design, implementation, and troubleshooting of LAN/WAN/Wireless networks, desktops and servers since 1989. His background in financial networks includes design and implementation of trading floor networks. Tony has taught at local high schools, Colleges/Universities, Networld/Interop and many onsite private classroom settings to thousands of analysts.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

OSTU - Automating Microsoft FTP Client (by Tony Fortunato)

  1. 1. Troubleshooting Tony Fortunato, Sr Network Specialist The Technology Firm Automating Microsoft’s FTP Client
  2. 2. What are you talking about? <ul><li>I’m in the middle of a troubleshooting exercise and have to FTP a file to a server </li></ul><ul><li>In this case I would like to automate this procedure so I can either schedule it, or run it from a batch file </li></ul><ul><li>Why should I have to type all the various FTP commands, when I can automate it? </li></ul><ul><li>I have also used this tip when performing baseline measurements and upgrading network equipment after hours </li></ul>
  3. 3. List of FTP commands for the Microsoft command-line FTP client <ul><li>ftp [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-w:windowsize] [computer] </li></ul><ul><li>-v - Suppresses verbose display of remote server responses. </li></ul><ul><li>-n - Suppresses auto-login upon initial connection. </li></ul><ul><li>-i - Turns off interactive prompting during multiple file transfers. </li></ul><ul><li>-d - Enables debugging, displaying all ftp commands passed between the client and server. </li></ul><ul><li>-g - Disables filename globbing, which permits the use of wildcard chracters in local file and path names. </li></ul><ul><li>-s:filename - Specifies a text file containing ftp commands; the commands will automatically run after ftp starts. No spaces are allowed in this parameter. Use this switch instead of redirection (>). </li></ul><ul><li>-a - Use any local interface when binding data connection. </li></ul><ul><li>-w:windowsize - Overrides the default transfer buffer size of 4096. </li></ul><ul><li>computer - Specifies the computer name or IP address of the remote computer to connect to. The computer, if specified, must be the last parameter on the line. </li></ul>
  4. 4. Some Common FTP Commands <ul><li>Open hostname – connects you to a ftp server </li></ul><ul><li>Bin – sets you to binary mode </li></ul><ul><li>Hash – shows those hash marks as you copy files </li></ul><ul><li>Cd – Change remote directory </li></ul><ul><li>Lcd – change local directory </li></ul><ul><li>Get – download a file </li></ul><ul><li>Mget – copies one or more remote files to the local computer </li></ul><ul><li>Put or send – upload a file </li></ul><ul><li>Delete – Deletes a file </li></ul><ul><li>Bye – ends your session </li></ul><ul><li>Disconnect – disconnects from the curent host, but keeps the ftp prompt up </li></ul>
  5. 5. Example <ul><li>Its pretty simple, </li></ul><ul><ul><li>FTP acme.txt to my ftp server as newfile.txt </li></ul></ul><ul><ul><li>Login; student </li></ul></ul><ul><ul><li>Password; password </li></ul></ul><ul><li>script.txt will look something like this </li></ul><ul><ul><li>open r2d2 </li></ul></ul><ul><ul><li>student </li></ul></ul><ul><ul><li>password </li></ul></ul><ul><ul><li>hash </li></ul></ul><ul><ul><li>bin </li></ul></ul><ul><ul><li>put acme.txt newfile.txt </li></ul></ul><ul><ul><li>bye </li></ul></ul><ul><li>Batch file (script.bat) or command to run the script </li></ul><ul><ul><li>ftp -s:script.txt </li></ul></ul>
  6. 6. Sample Output - Success <ul><li>C: esting123>script.bat </li></ul><ul><li>C: esting123>ftp -s:script.txt </li></ul><ul><li>ftp> open r2d2 </li></ul><ul><li>Connected to r2d2. </li></ul><ul><li>220 Welcome to Quick 'n Easy FTP Server </li></ul><ul><li>User (r2d2:(none)): </li></ul><ul><li>331 Password required for student </li></ul><ul><li>230 User successfully logged in. </li></ul><ul><li>ftp> hash </li></ul><ul><li>Hash mark printing On ftp: (2048 bytes/hash mark) . </li></ul><ul><li>ftp> bin </li></ul><ul><li>200 Type set to BINARY </li></ul><ul><li>ftp> put acme.txt newfile.txt </li></ul><ul><li>200 Port command successful. </li></ul><ul><li>150 Opening BINARY mode data connection for file transfer. </li></ul><ul><li>226 Transfer complete </li></ul><ul><li>ftp: 1 bytes sent in 0.00Seconds 1000.00Kbytes/sec. </li></ul><ul><li>ftp> bye </li></ul><ul><li>221 Bye </li></ul>
  7. 7. Wireshark Training - QuickStart Tony Fortunato, Sr Network Specialist The Technology Firm Thank you
  8. 8. <ul><li>For additional educational videos on Open Source Network Tools, please click on the following … </li></ul><ul><li>http://www.lovemytool.com/blog/ostu.html </li></ul>LoveMyTool.com – Community for Network Tools