HP-UX System Administrator's Guide: Configuration Management
2. Determine whether the file you are trying to transfer is an ASCII file or a binary
(non-ASCII) file and set the transfer mode accordingly:
a. For ASCII (plain text) files, set the transfer mode using FTP’s ascii command:
ftp>ascii
This enables character conversions such as end-of-line carriage return stripping
to occur.
b. For binary files (graphics files, sound files, database files, etc.), set the transfer
mode using FTP’s binary command:
ftp>binary
This causes FTP to use an eight-bit-wide (byte) transfer rather than a seven
bit wide (character) transfer. This is very important as most non-ASCII formats
are dependent on that eighth bit of each byte!
CAUTION: Your binary files will be corrupted if you transfer them using
ASCII mode.
TIP: If you are unsure of the format of the file you are transferring (ASCII
or binary) set the file type to binary. ASCII files will not be corrupted if
transferred in binary mode, however end-of-line character stripping will not
occur.
3. Transfer the file using FTP’s get command.
Example 5-5 Retrieve an ASCII File with FTP
To retrieve the ASCII file phone.dat (located in the subdirectory called data,
under the home directory for your account) from the HP-UX system:
ftp>cd data
ftp>ascii
ftp>get phone.dat
Example 5-6 Retrieve a Binary File with FTP
To then retrieve the graphics file net2.jpg (from the subdirectory called pics
located under the home directory):
ftp>cd ../pics
ftp>binary
ftp>get net2.jpg
Configuring File Transfer Protocol (FTP) 103