RADIO ONLINE (Click radio icon to listen)

Sunday 22 February 2015

Title: How to Upload/Download Any File To/From Any Server Using Windows Command Line Working With Batch File

How to Upload/Download Any File To/From Any Server Using Windows Command Line Working With Batch File



Windows has included batch files since before it existed… Batch files are really old! Old or not, I still could help us to automate common tasks. One common task is uploading files to a remote FTP server. 

Requirements:

  1. Must have ftp account (username and password, and ftp server address)
  2. Must know the filename that you wanna download/upload

Steps:
  1. Copy the codes below
  2. Open a notepad and paste into the notepad
  3. Save it as .bat in C:\ drive (Example: upanddown.bat)
@echo off
echo user %1> ftpcmd.dat
echo %2>> ftpcmd.dat
echo bin>> ftpcmd.dat
echo %3 %4>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat %5
del ftpcmd.dat

Do you understand?? Let's explain. 
%1: The FTP account username
%2: The FTP account password
%3: What do you want, download or upload (Put for upload. Get for download)
%4: The filename that you wanna download/upload to a server
%5: The FTP server address

Ok. Now, let say..
Your FTP account username: mircop
Your FTP account password: mircop1234
You wanna: download
You wanna get filename: test.txt
Your FTP aserver address: ftp.mircop.com

Now, open a command prompt. In the command prompt, type with a single line as below.

upanddown mircop mircop1234 get test.txt ftp.mircop.com
You will see in the command prompt box as below

C:\>upandown mircop mircop1234 get test.txt
Connected to ftp.mircop.com.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 11:33. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
ftp> user mircop
331 User mircop OK. Password required
230 OK. Current restricted directory is /
ftp> bin
200 TYPE is now 8-bit binary
ftp> get test.txt
200 PORT command successful
150-Connecting to port 3265
150 6.0 kbytes to download
226-File successfully transferred
226 0.000 seconds (measured here), 56.69 Mbytes per second
ftp: 6122 bytes received in 0.01Seconds 408.13Kbytes/sec.
ftp> quit
221-Goodbye. You uploaded 0 and downloaded 6 kbytes.
221 Logout.

C:\>


If you like this post, kindly linkback to this post entry by copying one of the codes below..

URL Of Post: Paste This HTML Code On Your Page:

3 comments:

  1. เว็บสล็อต PGZAA เปิดประสบการณ์เจอกับเกมสล็อตออนไลน์รูปแบบใหม่จากค่ายดังอย่าง ทำที่เหมาะสมที่สุดในยุคนี้ PG SLOT ไม่เล่นมิได้แล้ว แม้ท่านกำลังมองหาวิถีทาง

    ReplyDelete