Code Snippets

How to ftp a file to server? FTP Commands



What’s ftp?

Ftp   or File Transfer Protocol  is a protocol for transferring files between two computers on a network. The two computers must be on the Internet.

The ftp will have a   client and the server.The client will be your machine and server will be the machine on to which you are transferring your file to.

Starting your ftp client

Take command prompt and type  ftp

Ftp commands

When the ftp is started you can see like this

ftp>

Use the quit command to terminate your ftp client:

ftp> quit
 
You can list all the ftp commands using  “?”
ftp> ?

Connecting to a remote computer

Type open<servername>

If the server may or may not prompt for user id and password depending upon whether it is public or private.

Directory commands

ls  – > list file

ftp> dir
 
ld-à list directory
 
ftp> dir
 
Use the cd command to change to a different directory on the remote computer.

Commands to retrieve a file

 
The command get is used to retrieve a file from the server.
ftp> get install.txt

The following  get command specifies the new name readme.txt for the file being retrieved:

ftp> get read_me_first.txt readme.txt
 
The command mget can be used to retrieve a group of files
 

This command will get all the files ending in “.c”:

 

ftp> mget *.c
 

Your ftp client may prompt you before it retrieves each file that matches. If you want it to transfer the file, enter “Y” or “YES”.Files can be transferred as either ascii or binary. An ascii file is a file containing only printable characters. A binary file can contain printable and unprintable characters. Examples of binary files are executable files or files compressed to save space.

To transfer a file in binary mode, enter the binary command before the get command:

ftp> binary
ftp> get test.zip

Commands to send/transfer/upload a file to the server

The put command can  be used to upload a file to the server.

 
ftp> put prog1.txt
 

. For example, this put command specifies the new name prog1.txt:

 

ftp> put prog1.txt test.txt
 

If you are transferring a binary file, use the binary command before the put command:

 
ftp> binary
ftp> put test.exe
 

To transfer a group of files you can use mput . To transfer all files ending in “TXT” to the remote computer, enter this:

ftp> mput *.txt

Share

Thanks for reading my blog. If you like what I write, why not subscribe to my feed?

If you are busy, I can send the latest post to your email. Just subscribe to my email updates.

 

Enter your email address:

Delivered by FeedBurner

Discussion

No comments for “How to ftp a file to server? FTP Commands”

Post a comment