Command line FTP client in Windows

by admin on September 11, 2011

Windows has native ftp client which can be used to connect to any ftp servers with in LAN or outside LAN. Below you can learn how to use this command. You can also see examples for each command. This command works on all Windows releases : XP, Vista and Windows 7.

Connect to a ftp server

ftp  connect  hostname_or_ip

You will be prompted for user name and password to verify if you have access to the ftp server. Some servers provide anonymous access.

C:\>ftp ftp.mysite.net
Connected to ftp.mysite.net.
220 Mysite FTP Service
User (ftp.mysite.net:(none)): anonymous
331 Anonymous access allowed, send identity (e-mail name) as password.
Password:
230-Welcome to ftp.mysite.net.
230 User logged in.

How to download files after connecting to ftp server

Once you are connected to the server you can use the following commands in ftp command prompt

ls  – List the contents of the current directory.

ftp> ls
200 PORT command successful.
125 Data connection already open; Transfer starting.
bussys
deskapps
Products
PSS
226 Transfer complete.
ftp: 101 bytes received in 0.00Seconds 101000.00Kbytes/sec.

cd  directory_name :  Change to the specified directory

ftp> cd pss
250 CWD command successful.
ftp>

Download files from ftp server

get  filename : Download the file from ftp server to the local computer

ftp> get Filever.exe
200 PORT command successful.
125 Data connection already open; Transfer starting.
226 Transfer complete.
ftp: 55056 bytes received in 2.55Seconds 21.57Kbytes/sec.
ftp>

lcd directory_name : Change the directory of your local host.

ftp> lcd c:\users
Local directory now C:\Users.
ftp>

put filename :  Upload the file from your local host to the current directory in ftp server

ftp> put filever.exe
200 PORT command successful.
550 Access is denied.
ftp>

In this example, I don’t have write access to the ftp server, so I have got ‘Access is denied’ message from the server.

Download multiple files

We can use ‘mget *’ command to get multiple files from the server. But this command will prompt you for confirmation for each of the files.

ftp> mget *
200 Type set to A.
mget file1.exe? y
200 PORT command successful.
125 Data connection already open; Transfer starting.
226 Transfer complete.
ftp: 768784 bytes received in 46.89Seconds 16.40Kbytes/sec.
mget file2.exe? y
200 PORT command successful.
125 Data connection already open; Transfer starting.
226 Transfer complete.
ftp: 515584 bytes received in 31.02Seconds 16.62Kbytes/sec.
mget file3.exe? n
ftp>

This can be avoided by runing the  command ‘prompt‘ which sets the interactive mode to off.

ftp> mget *
200 Type set to A.
200 PORT command successful.
125 Data connection already open; Transfer starting.
226 Transfer complete.
ftp: 768784 bytes received in 46.08Seconds 16.69Kbytes/sec.
200 PORT command successful.
125 Data connection already open; Transfer starting.
226 Transfer complete.
ftp: 515584 bytes received in 32.41Seconds 15.91Kbytes/sec.
200 PORT command successful.
125 Data connection already open; Transfer starting.
226 Transfer complete.
ftp: 574464 bytes received in 34.50Seconds 16.65Kbytes/sec.
ftp>

Similarly we can use ‘mput *‘ command to upload multiple files to the ftp server.

Close the ftp connection

Finally, we can close the ftp connection by running  either of ‘quit’ or ‘bye’ commands.

{ 0 comments… add one now }

Leave a Comment

HTML tags are not allowed.

Previous post:

Next post: