Share this page : facebooktwitterlinkedinmailfacebooktwitterlinkedinmail

Here are some example of how to transfer and rename files using basic FTP or Command Prompt. Most Command Prompt will automatically be set in ascii format for transfers. Ascii format is used to transfer text files, this would include all text files and all htm/html files. If you are sending or receiving images or other files types you will need to set your transfer mode to binary. Binary transfer mode is for all other file types, GIFs JPGs, BMPs, .doc etc. Type bin to set the transfer mode to binary.

Type asc to change back to ascii transfers.

NOTE: The default transfer mode in FTP is ASCII Text. You must set the transfer mode to binary if the file is anything other than a standard ASCII text file (i.e. .gif or .jpg files)

Password:
230 User logged in, proceed.
ftp> bin
200 Type set to I.
ftp>
Rename

To rename a file that already exists in your FTP directory. In this case the file temp2 is being renamed to temp22.

ftp> rename temp2 temp22
350 File exists, ready for destination name
250 RNTO command successful.
ftp>

You can delete file using command delete.

Upload-put

To UPLOAD a file, type put C:\my-www\default2.htm, (Location of your file on your computer) and hit enter. This will transfer your file default2.htm from your computer: c:\my-www folder and place it in your root directory.

By default it will upload from your local machine’s user home folder to the server’s user home folder. Eg. on MAC from /Users/your_name to /var/www/vhost/your_account

ftp> put default2.htm
200 PORT Command successful.
150 Opening ASCII mode data connection for default2.htm.
226 Transfer complete.
2261 bytes sent in 0.00 seconds (2261000.00 Kbytes/sec)
ftp>
Download-get

To DOWNLOAD a file, type get C:\my-www\default2.htm and hit enter. This will transfer your file default2.htm from your root directory to your computer: c:\my-www folder.

ftp> get default2.htm
200 PORT Command successful.
550 Permission denied.
ftp>
Finish transfer

When the transfer is complete type quit at the ftp> prompt.

Work on the directory

To view all the contents of your current directory you can type:

ls

or:

dir

and the contents of that directory will be displayed.

You can move in and out of folders with the following commands:

to move into a folder:

cd foldername

and to move up one directory/folder:

cd ..

Other Commands

Once you get to the ftp> prompt you can type help to see a list of commands available.

ftp> help (list all of your commands)
Commands may be abbreviated. Commands are:
! delete literal prompt send
? debug ls put status
append dir mdelete pwd trace
ascii disconnect mdir quit type
bell get mget quote user
binary glob mkdir recv verbose
bye hash mls remotehelp
cd help mput rename
close lcd open rmdir
ftp>

You can have files and folders in your root directory. You will be able to create folders in your account and store files in those folders, they will be accessible by linking to them from a file in your root directory. The following commands may be helpful:

lcd – change local directory.
mkdir – make directory.
rmdir – remove directory.
pwd – print the current working directory.
mget mput – mget and mput allow you to move multiple files at once.