Windows 7: Download files using FTP from command-line

FTP is the File Transfer Protocol used to transfer files over internet. Using FTP we can download or upload the files.

Windows Operating System provides ftp commands to connect, download or upload data from/to FTP server.

  • Before downloading or uploading file(s) from/to FTP server, first we need to connect to the FTP server using proper user credentials.
  • Once the connection is established with the FTP server, start downloading or uploading the files.
  • Disconnect from FTP server, once the file(s) are downloaded or uploaded.

Here are step-by-step instructions to download a file using ftp command-line prompt in Windows 7 Operating System.

Step (1). Open Windows command-line prompt window.

Step (2). Type ftp at command prompt.

C:\ftp-downloads>ftp
ftp>

Step (3). Now you need to connect to the FTP server. Type the open command at ftp> prompt with FTP server name and port number to connect to the FTP server.

ftp> open <<provide-ftp-server-name-here>> <<port-number>>
Connected to xxxxxxxxxx.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 13 of 50 allowed.
220-Local time is now 22:05. Server port: 21.
220 You will be disconnected after 15 minutes of inactivity.
User (xxxxxxxxxxx:(none)): <<provide-user-name-here>>

Step (4). ftp console will prompt to enter the username and password. Provide the username and password details to connect to the FTP server.

User (xxxxxxxxxxx:(none)): xxx
331 User xxx OK. Password required
Password:
230 OK. Current restricted directory is /
ftp>

Step (5). Once user credentials are OK; ftp session is connected to the given FTP server.

Step (6). Before downloading file(s) from FTP server, you need to set the file transfer type. Currently there are two transfer types available. One is ascii transfer type another one is binary transfer type. ascii transfer type is used to transfer text files; and non-text files are transferred using binary type.

To see the existing transfer type just type the below command. It will display the current transfer type.

ftp> type
Using ascii mode to transfer files.

Usually most of the times we use binary transfer type to download/upload the file(s). So, type the below command to set the transfer type as binary.

ftp> type binary
200 TYPE is now 8-bit binary

Step (7). Now use get command to start downloading the file. The file is downloaded into the current folder location in your local system.

ftp> get <<file-name-here>>
200 PORT command successful
150-Connecting to port 47581
150 1236902.2 kbytes to download
226-File successfully transferred
226 385.989 seconds (measured here), 3.13 Mbytes per second
ftp: 1266587821 bytes received in 386.24Seconds 3279.29Kbytes/sec.
ftp>

Once the file is downloaded, ftp console will display the number of bytes transferred.

Step (8). Now disconnect from ftp using quit command. The connection will be disconnected and return to the Windows command-line prompt.

ftp> quit
221-Goodbye. You uploaded 0 and downloaded 1840403 kbytes.
221 Logout.

You can check the current folder location for downloaded file. Remember that through ftp command-line, data is not transferred in non-secured manner.

//

Leave a Reply