Examples, Mdelete, Example – HP Integrity NonStop H-Series User Manual

Page 62

Advertising
background image

Macros can save time, particularly if you include the definitions in the FTPCSTM file, which executes
during automatic logon.

Examples

In the following example, the macro getf is defined and then executed. This macro specifies a
mapping scheme and copies a file from a remote system:

ftp> macdef getf
Enter macro line by line, terminating it with a null line
nmap $vol1.subvol.\$1 \$1
get $1

Press RETURN to end macro. ftp> $getf filexyz Execute the macro for

filexyz. nmap $vol1.subvol.$1 $1
get filexyz
.
.
ftp>

Note that you must precede each $1 in the nmap command with a backslash to indicate that $1
is an argument of nmap and not an argument of the macro itself. When FTP processes the macro,
the backslash characters are stripped before the commands are executed. In the get command,
$1

is an argument of the macro; the value for the argument in this example is filexyz.

A macro that sets FTP session options (toggles) and file transfer parameters might be useful. For
example, assume the FTPCSTM file contains the following lines:

machine salesa Specify logon commands for login troy SALESA host. password zing
account zingzing
macdef setup Define macro named setup. binary Make type binary. case Override default case setting. nmap 1/2/3
3 Define mapping scheme. ntrans %^@ pc Define translation scheme. prompt Override default prompt setting.
runique Override default runique setting. pwd Display remote working directory.
macdef po Define macro named po. proxy open $1 $2 Include macro variables in proxy open.

When you automatically log on to the salesa system, the macros setup and po are defined.

To execute the macro po, enter the remote system name ($1) and, optionally, the port number ($2).
For example:

ftp> $po salesb

The next example defines the macro putfiles. This macro can be used to copy more than one
file to a remote system:

ftp> macdef putfiles
Enter macro line by line, terminating it with a null line
put $i

Press RETURN to end macro. ftp> verbose on

ftp> $putfiles a1 b1 c1 Execute the macro for files put a1 named a1, b1, and c1. 200 PORT command successful.
150 Opening data connection for a1...
226 Transfer complete.
local: a1 remote a1
310 bytes sent in 0.01 seconds...
put b1
200 PORT command successful.
.
.
put c1
.
.
local: c1 remote c1
4200 bytes sent in 0.15 seconds

mdelete

Use the mdelete command to delete a set of files from the remote system.

mdelete remote-files [ remote-files ] ...

remote-files

is a file name or a wild-card name specifying the files to be deleted. If you specify a wild-card
name, the glob toggle must be on.

Example

Assume the prompt toggle is on. The following command deletes from the current working directory
on the remote system all files that begin with the four letters cust and all files that end with the letter
x

:

62

FTP—Transferring Files

Advertising
This manual is related to the following products: