• Aucun résultat trouvé

Transferring Files

Dans le document DEC TCP/IP Services for VMS (Page 30-33)

The File Transfer Protocol

4.2 Transferring Files

When you use FTP to transfer VMS files to a UNIX system, certain record attributes may be lost because UNIX systems do not recognize VMS file attributes. For example, if you transfer an index file from VMS to UNIX and back to VMS, the resulting file's record attributes are lost.

The GET command retrieves a file from the remote host. The PUT command sends a file to a remote host.

To preserve these attributes, use the IFDL qualifier with the GET and PUT commands. This qualifier creates a secondary file that contains the file's VMS record attributes. When a file and its accompanying FDL file are copied from UNIX to VMS, the VMS system uses the FDL file to re-create the correct

attributes with the file. (Remember that first you have to PUT the file along with its attributes before you can GET that file.)

For example, the command PUT /FDL myfile creates an FDL description file for myfile, transfers the FDL file to the remote host, and then transfers myfile to the remote host.

The command GET /FDL myfile retrieves the FDL file that you created during the PUT operation. The local host creates a new file using the file attributes specified in the FDL file and then retrieves myfile, which is then appended to the new file.

If you do not specify the IFDL qualifier, the output file organization depends on the transfer type.

4.2.1 FTP File Specifications

When using FTP to transfer files to and from non-VMS systems, place quotation marks around any non-VMS file specification, as in the examples shown in this section.

If you use GET to transfer a file from a non-VMS system, you must specify the remote file specification in the correct syntax for the remote system. For example to transfer the file /usr/mydir/myfile from a non-VMS system to a VMS system, use the following command:

FTP>

If you are already in directory usr /mydir, type the following command:

FTP>

If you use PUT to transfer a file to a non-VMS system, you must specify the remote file specification in the correct syntax for the remote system. For example, to transfer the file MYFILE.TXT from a VMS system to the directory /usr /mydir on a UNIX-based system, use the following command:

FTP>

The File Transfer Protocol 4-3

If you are already in directory usr/mydir, type the following command:

FTP>

This creates a file called myfile on the remote system.

4.2.2 Using the ILOWERCASE and INOVERSION Qualifiers

When you use PUT to transfer files from a VMS system to a non-VMS system, the file names are transferred in uppercase with version numbers. This is undesirable on many systems. If you want the file names to be transferred in lowercase and without version numbers, you can use the /LOWERCASE and INOVERSION qualifiers with the PUT command. These qualifiers ensure that the file is transferred to the remote system in lowercase and without version numbers. For example, the following command transfers the latest version of MYFILE.TXT to the remote system as myfile. txt:

FTP>

4.2.3 Sending Files to a Printer Using GET and PUT

You can use GET and PUT to send files directly to a printer while in an FTP session. To use this feature, you must specify the actual name of the printer; you cannot use the queue name or logical name. In addition, you can send individual files only to a printer (rather than batches). For example, the following command sends the file MEMO.TXT from the local host directly to the printer LNAX: on the remote host:

FTP> PUT MEMO. TXT LNAX:

Note that to use this feature with the PUT command, the feature must be supported on the FTP server on the remote system.

The following GET command gets the file Q4EARNINGS and sends it directly to the printer LPAO:

FTP> GET Q4EARNINGS LPAO:

4.2.4 Using Wildcards

The DCL FTP command interface allows you to use standard VMS wildcards in the following commands:

• DELETE

• DIRECTORY

• GET

• PUT

The wildcard characters recognized by FTP are as follows:

• The percent sign (%) to represent individual characters

• The asterisk (*) to represent multiple characters

If you are using FTP to transfer files to and from non-VMS systems, you must know the file specification conventions for those systems.

If you use wildcards to transfer files to non-VMS systems, you cannot specify a remote file specification. Because files are transferred in uppercase with version numbers by default, you may want to use the /LOWERCASE and INOVERSION qualifiers during wildcard transfers.

4-4 The File Transfer Protocol

4.2.5 Specifying the Data Type

The SET TYPE command specifies the data type for data transfer. There are two kinds of data types:

• ASCII (the default), which is transferred in 8-bit NVT_ASCII representation.

This type transfers data character by character. The resulting file is a sequential file in the VMS Stream_LF format. Select this type when transferring ASCII files.

• IMAGE type, which is transferred as contiguous 8-bit bytes. The resulting output file has fixed lengthr~ords of 512 bytes. Select this type when transferring non-ASCII files, such- as executable image files.

For example, to specify the IMAGE data type, issue the following command:

FTP>

4.2.6 Specifying the Mode

The SET MODE command specifies the mode for data transfer. Applications software supports only STREAM mode. STREAM mode transmits the data as a stream of bytes.

4.2.7 Specifying the File Structure

The SET STRU command specifies the structure of a file for data transfer. Once this command has been sent to the FTP server, any subsequent GET or PUT command will transfer the file in the specified structure. Applications software supports FILE and RECORD structure.

• FILE structure (the default), has no internal structure. A file is a continuous sequence of data bytes. A DIR/FULL command for the file will show the record format field as STREAM_LF.

• RECORD structured files are sequential with variable records. A DIR/FULL command for a file that was written by FTP will show the record format field as variable length.

You can use the FTP DIR/FULL command to check the structure of a file before and after using the SET STRU command. Refer to your RMS documentation for details on record formats for VMS.

For example, to copy MYFILE in RECORD structure, issue the following /FULL of MYFILE will show the record format field to be variable length.

Not all systems support the RECORD file structure. If a UCX FTP client on a VMS system sends a SET STRU command to an FTP server that does not support RECORD structure, the SET STRU command is ignored.

If the server does not support the RECORD file structure and you want to copy a file in RECORD structure from a UNIX system to a VMS system, you can do the following:

1. FTP to the VMS system.

The File Transfer Protocol 4-5

2. Enter a quote stru r command. The quote command will send stru r to the FTP server on the VMS system to let the FTP server set the record structure.

3. Enter a put 'of the file on the UNIX system to the VMS system.

For example, to transfer myfile from abyss (an ULTRIX system) to LASSIE (a VMS system) in RECORD structure, enter the following commands:

abyss>

ftp>

ftp>

Dans le document DEC TCP/IP Services for VMS (Page 30-33)