next up previous
Next: Renaming, Deleting Files and Up: Simple FTP Client Sessions Previous: Uploading Files

Additional File Transfer Settings

In addition to setting the file transfer type of transmission the following commands affect other aspects of file transfer:

glob
-- Toggle filename expansion, or "globbing", for mdelete, mget and mput. If globbing is turned off, filenames are taken literally.

Globbing for mput is done as in ************sh(1). For mdelete and mget, each remote file name is expanded separately on the remote machine, and the lists are not merged.

nmap
[ inpattern outpattern ] Set or unset the filename mapping mechanism. If no arguments are specified, the filename mapping mechanism is unset. If arguments are specified, remote filenames are mapped during mput commands and put commands issued without a specified remote target filename. If arguments are specified, local filenames are mapped during mget commands and get commands issued without a specified local target filename.

This command is useful when connecting to a non- UNIX-system remote host with different file naming conventions or practices. The mapping follows the pattern set by inpattern and outpattern . inpattern is a template for incoming filenames (which may have already been processed according to the ntrans and case settings). Variable templating is accomplished by including the sequences $1, $2, ..., $9 in inpattern. Use $\backslash$ to prevent this spe- cial treatment of the $ character. All other char- acters are treated literally, and are used to determine the nmap inpattern variable values.

For example, given inpattern $1.$2 and the remote file name mydata.data, $1 would have the value mydata, and $2 would have the value data.

The outpattern determines the resulting mapped filename. The sequences $1, $2, ..., $9 are replaced by any value resulting from the inpattern template. The sequence $0 is replaced by the ori- ginal filename. Additionally, the sequence [seq1 ,seq2 ] is replaced by seq1 if seq1 is not a null string; otherwise it is replaced by seq2 .

For example, the command

nmap $1.$2.$3 [$1,$2].[$2,file]

would yield the output filename myfile.data for input filenames myfile.data and myfile.data.old, myfile.file for the input filename myfile, and myfile.myfile for the input filename .myfile.

ntrans
[inchars [ outchars ] ] Set or unset the filename character translation mechanism. If no arguments are specified, the filename character translation mechanism is unset. If arguments are specified, characters in remote filenames are translated during mput commands and put commands issued without a specified remote target filename, and characters in local filenames are translated during mget commands and get commands issued without a specified local target filename.

This command is useful when connecting to a non-UNIX-system remote host with different file naming conventions or practices. Characters in a filename matching a character in inchars are replaced with the corresponding character in outchars. If the character's position in inchars is longer than the length of outchars , the character is deleted from the file name.

Only 16 characters can be translated when using the ntrans command under ftp. Use case (described above) if needing to convert the entire alphabet.


next up previous
Next: Renaming, Deleting Files and Up: Simple FTP Client Sessions Previous: Uploading Files
Dave Marshall
9/28/2001