Most important FTP commands
Binary transfer
binary
Get a file
gettiedosto
Get a list of (multiple) files
mgetlista
Put a file
puttiedosto
Put a list of (multiple) files
mputlista
Delete a file
deletetiedosto
Delete a list of (mutliple) files
mdeletelista
Rename a file
renametied1tied2
List the contents of a directory
dir [hakemisto]
Go to (change) remote directory
cdhakemisto
Go to (change) local directory
lcdhakemisto
Create (make) a directory
mkdirhakemisto
Delete (remove) a directory
rmdirhakemisto
FTP at CSC
FTP is not necessary for transfers within CSC. The transfer can be made through the shared metawork directory or by using the rcp command from local directories. In conjunction with opening an FTP session, the user ID and password are passed to the network in clear-text format. Hence, using FTP should be avoided for transfers over unsecured network connections.
The use of FTP is also handicapped, because there are two different modes to make the transfer: ASCII and binary transfer. For transfers between Unix machines the binary transfer is recommended for transferring all files. Different machines use different default values for the transfer mode.
The safest way is to give the binary command before you start to transfer files. This is especially important when transferring compressed files (e.g. with extension .gz). Additionally, when files are transferred from PC systems or to a PC, the length of names or possible unacceptable characters must first be converted into suitable form.
The transfer of files on the local disk, between the current and remote directories is made by using commands put and get. Multiple files can be transferred with commands mput and mget, and the file list can contain wildcard characters (* or ?). Note that directories cannot be transferred.
For every file, FTP asks for a confirmation if you want to transfer the file. Before the transfer, you can give a command prompt, which makes the transfer without the confirmation request.
If a file with the same name exists already, the new file will replace the old one. This can be prevented by the commands sunique (send unique) or runique (receive unique). These commands create a new version of the file by adding a sequence number at the end of the name.
The remote directory is changed with the command cd. Changing from one local disk directory to another is made with the command lcd. Other local disk commands can be given by typing an exclamation mark (!) in front of the command.
Below is an example of transferring files to a server:
ftp [server name]
1. A new remote directory result is made
ftp> mkdir result
2.Change to a local directory,
where the files to be transferred are located
ftp> lcd local_dir
3. Change to remote directory result
ftp> cd result
4. Prompt a transfer without confirmation
ftp> prompt
5.Transfer the data in binary form.
ftp> binary
6. Transfer the files, the name of which starts
with letters ajo.
ftp> mput ajo*
7. Print out a directory list to ensure
that all files were transferred.
ftp> dir
8. Print out also a
directory list of the local disk files.
ftp> !ls -l ajo*
9.Quit ftp.
ftp> quit