1ZSHZFTPSYS(1)               General Commands Manual              ZSHZFTPSYS(1)
2
3
4

NAME

6       zshzftpsys - zftp function front-end
7

DESCRIPTION

9       This describes the set of shell functions supplied with the source dis‐
10       tribution as an interface to the zftp builtin command, allowing you  to
11       perform  FTP operations from the shell command line or within functions
12       or scripts.  The interface is similar to a traditional FTP client (e.g.
13       the  ftp command itself, see ftp(1)), but as it is entirely done within
14       the shell all the familiar completion, editing and  globbing  features,
15       and  so on, are present, and macros are particularly simple to write as
16       they are just ordinary shell functions.
17
18       The prerequisite is that the zftp  command,  as  described  in  zshmod‐
19       ules(1)  ,  must  be  available in the version of zsh installed at your
20       site.  If the shell is configured to load new commands at run time,  it
21       probably  is:  typing  `zmodload zsh/zftp' will make sure (if that runs
22       silently, it has worked).  If this is not the case, it is possible zftp
23       was  linked  into the shell anyway: to test this, type `which zftp' and
24       if zftp is available you will get the  message  `zftp:  shell  built-in
25       command'.
26
27       Commands  given  directly with zftp builtin may be interspersed between
28       the functions in this suite; in a few cases, using  zftp  directly  may
29       cause  some  of  the  status  information stored in shell parameters to
30       become invalid.  Note in particular the description  of  the  variables
31       $ZFTP_TMOUT, $ZFTP_PREFS and $ZFTP_VERBOSE for zftp.
32

INSTALLATION

34       You  should  make sure all the functions from the Functions/Zftp direc‐
35       tory of the source distribution are available; they all begin with  the
36       two letters `zf'.  They may already have been installed on your system;
37       otherwise, you will need to find them and  copy  them.   The  directory
38       should  appear  as one of the elements of the $fpath array (this should
39       already be the case if they were installed), and at least the  function
40       zfinit  should  be  autoloaded; it will autoload the rest.  Finally, to
41       initialize the use of the system you need to call the zfinit  function.
42       The  following  code  in  your .zshrc will arrange for this; assume the
43       functions are stored in the directory ~/myfns:
44
45              fpath=(~/myfns $fpath)
46              autoload -U zfinit
47              zfinit
48
49       Note that zfinit assumes you are using the zmodload method to load  the
50       zftp  command.  If it is already built into the shell, change zfinit to
51       zfinit -n.  It is helpful (though not essential) if the call to  zfinit
52       appears  after  any  code to initialize the new completion system, else
53       unnecessary compctl commands will be given.
54

FUNCTIONS

56       The sequence of operations in performing a file transfer is essentially
57       the  same  as that in a standard FTP client.  Note that, due to a quirk
58       of the shell's getopts builtin, for those functions that handle options
59       you must use `--' rather than `-' to ensure the remaining arguments are
60       treated literally (a single `-' is treated as an argument).
61
62   Opening a connection
63       zfparams [ host [ user [ password ... ] ] ]
64              Set or show the parameters for a future  zfopen  with  no  argu‐
65              ments.   If  no  arguments are given, the current parameters are
66              displayed (the password will be shown as a line  of  asterisks).
67              If a host is given, and either the user or password is not, they
68              will be prompted for; also, any parameter given as `?'  will  be
69              prompted  for, and if the `?' is followed by a string, that will
70              be used as the prompt.  As zfopen calls zfparams  to  store  the
71              parameters, this usually need not be called directly.
72
73              A  single  argument `-' will delete the stored parameters.  This
74              will also cause the memory of the last directory (and so on)  on
75              the other host to be deleted.
76
77       zfopen [ -1 ] [ host [ user [ password [ account ] ] ] ]
78              If  host  is present, open a connection to that host under user‐
79              name user with password password (and,  on  the  rare  occasions
80              when  it is necessary, account account).  If a necessary parame‐
81              ter is missing or given as `?' it will be prompted for.  If host
82              is not present, use a previously stored set of parameters.
83
84              If  the  command  was successful, and the terminal is compatible
85              with xterm or is sun-cmd, a summary will  appear  in  the  title
86              bar,  giving the local host:directory and the remote host:direc‐
87              tory; this is handled  by  the  function  zftp_chpwd,  described
88              below.
89
90              Normally,  the  host,  user and password are internally recorded
91              for later re-opening, either by a zfopen with no  arguments,  or
92              automatically (see below).  With the option `-1', no information
93              is stored.  Also, if an open command with arguments failed,  the
94              parameters  will  not  be  retained (and any previous parameters
95              will also be deleted).  A zfopen on its own,  or  a  zfopen  -1,
96              never alters the stored parameters.
97
98              Both zfopen and zfanon (but not zfparams) understand URLs of the
99              form ftp://host/path... as meaning to connect to the host,  then
100              change  directory  to  path  (which  must  be a directory, not a
101              file).  The `ftp://' can be omitted; the trailing `/' is  enough
102              to  trigger  recognition  of the path.  Note prefixes other than
103              `ftp:' are not recognized, and that  all  characters  after  the
104              first slash beyond host are significant in path.
105
106       zfanon [ -1 ] host
107              Open  a connection host for anonymous FTP.  The username used is
108              `anonymous'.  The password (which will  be  reported  the  first
109              time)  is  generated  as  user@host;  this is then stored in the
110              shell parameter $EMAIL_ADDR which can alternatively be set manu‐
111              ally to a suitable string.
112
113   Directory management
114       zfcd [ dir ]
115       zfcd -
116       zfcd old new
117              Change  the  current  directory  on  the remote server:  this is
118              implemented to have many of the features of  the  shell  builtin
119              cd.
120
121              In the first form with dir present, change to the directory dir.
122              The command `zfcd ..' is treated specially, so is guaranteed  to
123              work  on  non-UNIX  servers  (note this is handled internally by
124              zftp).  If dir is omitted, has the effect of `zfcd ~'.
125
126              The second form changes to the directory previously current.
127
128              The third form attempts  to  change  the  current  directory  by
129              replacing the first occurrence of the string old with the string
130              new in the current directory.
131
132              Note that in this command, and indeed anywhere a remote filename
133              is  expected,  the string which on the local host corresponds to
134              `~' is converted back to a `~' before being passed to the remote
135              machine.   This  is  convenient  because of the way expansion is
136              performed on the command line before  zfcd  receives  a  string.
137              For  example,  suppose  the  command is `zfcd ~/foo'.  The shell
138              will   expand   this   to   a   full   path   such   as    `zfcd
139              /home/user2/pws/foo'.   At  this stage, zfcd recognises the ini‐
140              tial path as corresponding to `~' and will send the directory to
141              the  remote  host  as ~/foo, so that the `~' will be expanded by
142              the server to the correct remote host  directory.   Other  named
143              directories of the form `~name' are not treated in this fashion.
144
145       zfhere Change  directory  on the remote server to the one corresponding
146              to the current local directory, with special handling of `~'  as
147              in  zfcd.   For  example,  if  the  current  local  directory is
148              ~/foo/bar, then zfhere performs the effect of `zfcd ~/foo/bar'.
149
150       zfdir [ -rfd ] [ - ] [ dir-options ] [ dir ]
151              Produce a long directory listing.  The arguments dir-options and
152              dir are passed directly to the server and their effect is imple‐
153              mentation dependent, but specifying a particular  remote  direc‐
154              tory  dir  is  usually possible.  The output is passed through a
155              pager given by the environment variable  $PAGER,  or  `more'  if
156              that is not set.
157
158              The directory is usually cached for re-use.  In fact, two caches
159              are maintained.  One is for use when there is no dir-options  or
160              dir,  i.e. a full listing of the current remote directory; it is
161              flushed when the current remote directory changes.  The other is
162              kept  for  repeated  use  of  zfdir with the same arguments; for
163              example, repeated use of `zfdir /pub/gnu' will only require  the
164              directory  to  be  retrieved  on the first call.  Alternatively,
165              this cache can be re-viewed with the  -r  option.   As  relative
166              directories  will  confuse  zfdir,  the -f option can be used to
167              force the cache to be flushed before the  directory  is  listed.
168              The  option  -d will delete both caches without showing a direc‐
169              tory listing; it will also delete the cache of file names in the
170              current remote directory, if any.
171
172       zfls [ ls-options ] [ dir ]
173              List  files  on the remote server.  With no arguments, this will
174              produce a simple list of  file  names  for  the  current  remote
175              directory.  Any arguments are passed directly to the server.  No
176              pager and no caching is used.
177
178   Status commands
179       zftype [ type ]
180              With no arguments, show the type of data to be transferred, usu‐
181              ally  ASCII  or  binary.  With an argument, change the type: the
182              types `A' or `ASCII' for ASCII data and `B' or `BINARY', `I'  or
183              `IMAGE' for binary data are understood case-insensitively.
184
185       zfstat [ -v ]
186              Show  the  status  of the current or last connection, as well as
187              the status of some of zftp's  status  variables.   With  the  -v
188              option,  a  more  verbose  listing  is  produced by querying the
189              server for its version of events, too.
190
191   Retrieving files
192       The commands for retrieving files all take at  least  two  options.  -G
193       suppresses remote filename expansion which would otherwise be performed
194       (see below for a more detailed description of that).   -t  attempts  to
195       set the modification time of the local file to that of the remote file:
196       see the description of the function zfrtime below for more information.
197
198       zfget [ -Gtc ] file1 ...
199              Retrieve all the listed files file1 ... one at a time  from  the
200              remote  server.   If  a  file  contains  a `/', the full name is
201              passed to the remote server, but  the  file  is  stored  locally
202              under  the  name  given  by  the  part after the final `/'.  The
203              option -c (cat) forces all files to be sent as a  single  stream
204              to standard output; in this case the -t option has no effect.
205
206       zfuget [ -Gvst ] file1 ...
207              As  zfget,  but  only  retrieve  files  where the version on the
208              remote server is newer (has a later modification time), or where
209              the  local file does not exist.  If the remote file is older but
210              the files have different sizes, or if the sizes are the same but
211              the  remote  file  is  newer,  the user will usually be queried.
212              With the option -s, the command runs silently  and  will  always
213              retrieve the file in either of those two cases.  With the option
214              -v, the command prints more information about the files while it
215              is working out whether or not to transfer them.
216
217       zfcget [ -Gt ] file1 ...
218              As  zfget,  but if any of the local files exists, and is shorter
219              than the corresponding remote file, the command assumes that  it
220              is  the result of a partially completed transfer and attempts to
221              transfer the rest of the file.  This is useful on a poor connec‐
222              tion which keeps failing.
223
224              Note  that  this  requires a commonly implemented, but non-stan‐
225              dard, version of the FTP protocol, so is not guaranteed to  work
226              on all servers.
227
228       zfgcp [ -Gt ] remote-file local-file
229       zfgcp [ -Gt ] rfile1 ... ldir
230              This  retrieves  files  from  the  remote  server with arguments
231              behaving similarly to the cp command.
232
233              In the first form, copy remote-file from the server to the local
234              file local-file.
235
236              In  the  second  form, copy all the remote files rfile1 ... into
237              the local directory ldir retaining  the  same  basenames.   This
238              assumes UNIX directory semantics.
239
240   Sending files
241       zfput [ -r ] file1 ...
242              Send  all  the  file1 ... given separately to the remote server.
243              If a filename contains a `/', the full filename is used  locally
244              to  find  the file, but only the basename is used for the remote
245              file name.
246
247              With the option -r, if any of the files are directories they are
248              sent  recursively with all their subdirectories, including files
249              beginning with `.'.   This  requires  that  the  remote  machine
250              understand UNIX file semantics, since `/' is used as a directory
251              separator.
252
253       zfuput [ -vs ] file1 ...
254              As zfput, but only send files which are newer than their  remote
255              equivalents, or if the remote file does not exist.  The logic is
256              the same as for zfuget, but reversed between  local  and  remote
257              files.
258
259       zfcput file1 ...
260              As  zfput,  but if any remote file already exists and is shorter
261              than the local equivalent, assume it is the result of an  incom‐
262              plete  transfer  and  send the rest of the file to append to the
263              existing part.  As the FTP append command is part of  the  stan‐
264              dard set, this is in principle more likely to work than zfcget.
265
266       zfpcp local-file remote-file
267       zfpcp lfile1 ... rdir
268              This  sends  files  to the remote server with arguments behaving
269              similarly to the cp command.
270
271              With  two  arguments,  copy  local-file   to   the   server   as
272              remote-file.
273
274              With  more  than  two arguments, copy all the local files lfile1
275              ... into the existing remote directory rdir retaining  the  same
276              basenames.  This assumes UNIX directory semantics.
277
278              A  problem  arises if you attempt to use zfpcp lfile1 rdir, i.e.
279              the second form of copying but with two arguments, as  the  com‐
280              mand  has  no  simple  way  of  knowing if rdir corresponds to a
281              directory or a filename.  It attempts to resolve this in various
282              ways.   First,  if the rdir argument is `.' or `..' or ends in a
283              slash, it is assumed to be a directory.  Secondly, if the opera‐
284              tion  of  copying to a remote file in the first form failed, and
285              the remote server sends back the expected failure code 553 and a
286              reply  including  the  string  `Is a directory', then zfpcp will
287              retry using the second form.
288
289   Closing the connection
290       zfclose
291              Close the connection.
292
293   Session management
294       zfsession [ -lvod ] [ sessname ]
295              Allows you to manage multiple FTP sessions at once.  By default,
296              connections  take place in a session called `default'; by giving
297              the command `zfsession sessname' you can  change  to  a  new  or
298              existing  session  with  a name of your choice.  The new session
299              remembers its own connection, as well as associated shell param‐
300              eters, and also the host/user parameters set by zfparams.  Hence
301              you can have different sessions set up to connect  to  different
302              hosts, each remembering the appropriate host, user and password.
303
304              With no arguments, zfsession prints the name of the current ses‐
305              sion; with the option -l it lists all sessions  which  currently
306              exist,  and  with  the option -v it gives a verbose list showing
307              the host and directory for each session, where the current  ses‐
308              sion is marked with an asterisk.  With -o, it will switch to the
309              most recent previous session.
310
311              With -d, the given session (or else the current one) is removed;
312              everything to do with it is completely forgotten.  If it was the
313              only session, a new session called `default' is created and made
314              current.   It  is safest not to delete sessions while background
315              commands using zftp are active.
316
317       zftransfer sess1:file1 sess2:file2
318              Transfer files between two sessions; no local copy is made.  The
319              file is read from the session sess1 as file1 and written to ses‐
320              sion sess2 as file file2; file1 and file2 may be relative to the
321              current  directories  of the session.  Either sess1 or sess2 may
322              be omitted (though the colon should be retained if  there  is  a
323              possibility  of a colon appearing in the file name) and defaults
324              to the current session; file2 may be omitted or may end  with  a
325              slash,  in  which case the basename of file1 will be added.  The
326              sessions sess1 and sess2 must be distinct.
327
328              The operation is performed using pipes, so it is  required  that
329              the  connections  still be valid in a subshell, which is not the
330              case under versions of some operating systems, presumably due to
331              a system bug.
332
333   Bookmarks
334       The two functions zfmark and zfgoto allow you to `bookmark' the present
335       location (host, user and directory) of the current FTP  connection  for
336       later use.  The file to be used for storing and retrieving bookmarks is
337       given by the parameter $ZFTP_BMFILE; if not set when  one  of  the  two
338       functions  is  called,  it  will  be  set to the file .zfbkmarks in the
339       directory where your zsh startup files live (usually ~).
340
341       zfmark [ bookmark ]
342              If given an argument, mark the current host, user and  directory
343              under the name bookmark for later use by zfgoto.  If there is no
344              connection open, use the values for the last connection  immedi‐
345              ately  before  it  was closed; it is an error if there was none.
346              Any existing bookmark under  the  same  name  will  be  silently
347              replaced.
348
349              If  not  given  an argument, list the existing bookmarks and the
350              points to which they refer in the form user@host:directory; this
351              is  the  format  in  which  they are stored, and the file may be
352              edited directly.
353
354       zfgoto [ -n ] bookmark
355              Return to the location given by bookmark, as previously  set  by
356              zfmark.  If the location has user `ftp' or `anonymous', open the
357              connection with zfanon, so that no password is required.  If the
358              user and host parameters match those stored for the current ses‐
359              sion, if any, those will be  used,  and  again  no  password  is
360              required.  Otherwise a password will be prompted for.
361
362              With  the  option  -n,  the  bookmark  is taken to be a nickname
363              stored by the ncftp program  in  its  bookmark  file,  which  is
364              assumed  to  be  ~/.ncftp/bookmarks.  The function works identi‐
365              cally in other ways.  Note that there is no mechanism for adding
366              or modifying ncftp bookmarks from the zftp functions.
367
368   Other functions
369       Mostly,  these  functions  will  not  be  called  directly  (apart from
370       zfinit), but are described here for  completeness.   You  may  wish  to
371       alter zftp_chpwd and zftp_progress, in particular.
372
373       zfinit [ -n ]
374              As described above, this is used to initialize the zftp function
375              system.  The -n option should be used if  the  zftp  command  is
376              already built into the shell.
377
378       zfautocheck [ -dn ]
379              This  function is called to implement automatic reopening behav‐
380              iour, as described in  more  detail  below.   The  options  must
381              appear  in  the  first  argument;  -n  prevents the command from
382              changing to the old directory, while -d prevents it from setting
383              the  variable  do_close,  which  it otherwise does as a flag for
384              automatically closing the connection after a transfer.  The host
385              and  directory  for  the last session are stored in the variable
386              $zflastsession, but the internal  host/user/password  parameters
387              must also be correctly set.
388
389       zfcd_match prefix suffix
390              This performs matching for completion of remote directory names.
391              If the remote server is UNIX, it will attempt  to  persuade  the
392              server  to list the remote directory with subdirectories marked,
393              which usually works but is not guaranteed.  On  other  hosts  it
394              simply calls zfget_match and hence completes all files, not just
395              directories.  On some systems, directories  may  not  even  look
396              like filenames.
397
398       zfget_match prefix suffix
399              This  performs  matching for completion of remote filenames.  It
400              caches files for the  current  directory  (only)  in  the  shell
401              parameter  $zftp_fcache.   It is in the form to be called by the
402              -K option of compctl, but also works when  called  from  a  wid‐
403              get-style  completion function with prefix and suffix set appro‐
404              priately.
405
406       zfrglob varname
407              Perform remote globbing, as  describes  in  more  detail  below.
408              varname  is  the name of a variable containing the pattern to be
409              expanded; if there were any matches, the same variable  will  be
410              set to the expanded set of filenames on return.
411
412       zfrtime lfile rfile [ time ]
413              Set  the  local file lfile to have the same modification time as
414              the remote file rfile, or the explicit time time in  FTP  format
415              CCYYMMDDhhmmSS  for  the  GMT  timezone.   This uses the shell's
416              zsh/datetime module to perform the conversion from GMT to  local
417              time.
418
419       zftp_chpwd
420              This  function  is  called every time a connection is opened, or
421              closed, or the remote directory changes.   This  version  alters
422              the  title bar of an xterm-compatible or sun-cmd terminal emula‐
423              tor to reflect the local and remote hostnames and current direc‐
424              tories.   It  works  best when combined with the function chpwd.
425              In particular, a function of the form
426
427                     chpwd() {
428                       if [[ -n $ZFTP_USER ]]; then
429                         zftp_chpwd
430                       else
431                         # usual chpwd e.g put host:directory in title bar
432                       fi
433                     }
434
435              fits in well.
436
437       zftp_progress
438              This function shows the status of the  transfer.   It  will  not
439              write  anything  unless  the output is going to a terminal; how‐
440              ever, if you transfer files in the background, you  should  turn
441              off  progress  reports  by hand using `zstyle ':zftp:*' progress
442              none'.  Note also that if you alter it, any output  must  be  to
443              standard error, as standard output may be a file being received.
444              The form of the progress meter, or whether it is  used  at  all,
445              can be configured without altering the function, as described in
446              the next section.
447
448       zffcache
449              This is used to implement caching of files in the current direc‐
450              tory for each session separately.  It is used by zfget_match and
451              zfrglob.
452

MISCELLANEOUS FEATURES

454   Configuration
455       Various styles are available using the standard shell style  mechanism,
456       described  in  zshmodules(1).  Briefly,  the  command `zstyle ':zftp:*'
457       style value ...'.  defines the style to have value value; more than one
458       value  may be given, although that is not useful in the cases described
459       here.  These values will then be used throughout the zftp function sys‐
460       tem.   For more precise control, the first argument, which gives a con‐
461       text in which the style applies, can be modified to include a  particu‐
462       lar  function,  as  for example `:zftp:zfget': the style will then have
463       the given value only in the zfget function.  Values for the same  style
464       in  different  contexts  may be set; the most specific function will be
465       used, where strings are held to be more  specific  than  patterns,  and
466       longer  patterns  and  shorter  patterns.  Note that only the top level
467       function name, as called by the user, is used; calling of  lower  level
468       functions is transparent to the user.  Hence modifications to the title
469       bar in zftp_chpwd use  the  contexts  :zftp:zfopen,  :zftp:zfcd,  etc.,
470       depending  where  it  was called from.  The following styles are under‐
471       stood:
472
473       progress
474              Controls the way that zftp_progress reports on the progress of a
475              transfer.   If  empty,  unset,  or `none', no progress report is
476              made; if `bar' a growing bar of inverse video is shown; if `per‐
477              cent'  (or  any other string, though this may change in future),
478              the percentage of the file transferred is shown.  The bar  meter
479              requires  that  the  width  of the terminal be available via the
480              $COLUMNS parameter (normally this is set automatically).  If the
481              size  of  the  file  being transferred is not available, bar and
482              percent meters will simply show the number of bytes  transferred
483              so far.
484
485              When zfinit is run, if this style is not defined for the context
486              :zftp:*, it will be set to `bar'.
487
488       update Specifies the minimum  time  interval  between  updates  of  the
489              progress  meter  in  seconds.  No update is made unless new data
490              has been received, so the actual time interval is  limited  only
491              by $ZFTP_TIMEOUT.
492
493              As  described for progress, zfinit will force this to default to
494              1.
495
496       remote-glob
497              If set to `1', `yes' or `true', filename  generation  (globbing)
498              is performed on the remote machine instead of by zsh itself; see
499              below.
500
501       titlebar
502              If set to `1', `yes' or `true', zftp_chpwd will put  the  remote
503              host  and  remote directory into the titlebar of terminal emula‐
504              tors such as xterm or sun-cmd that allow this.
505
506              As described for progress, zfinit will force this to default  to
507              1.
508
509       chpwd  If set to `1' `yes' or `true', zftp_chpwd will call the function
510              chpwd when a connection is closed.  This is useful if the remote
511              host  details were put into the terminal title bar by zftp_chpwd
512              and your usual chpwd also modifies the title bar.
513
514              When zfinit is run, it will determine whether chpwd  exists  and
515              if  so  it will set the default value for the style to 1 if none
516              exists already.
517
518       Note that there is also an associative array  zfconfig  which  contains
519       values  used  by  the  function system.  This should not be modified or
520       overwritten.
521
522   Remote globbing
523       The commands for retrieving files usually perform  filename  generation
524       (globbing)  on  their  arguments; this can be turned off by passing the
525       option -G to each of the commands.  Normally this operates by  retriev‐
526       ing a complete list of files for the directory in question, then match‐
527       ing these locally against the pattern supplied.  This has the advantage
528       that  the  full  range  of  zsh patterns (respecting the setting of the
529       option EXTENDED_GLOB) can be used.  However, it means that  the  direc‐
530       tory part of a filename will not be expanded and must be given exactly.
531       If the remote server does not support  the  UNIX  directory  semantics,
532       directory  handling  is problematic and it is recommended that globbing
533       only be used within the current directory.  The list of  files  in  the
534       current  directory,  if  retrieved,  will be cached, so that subsequent
535       globs in the same  directory  without  an  intervening  zfcd  are  much
536       faster.
537
538       If  the  remote-glob style (see above) is set, globbing is instead per‐
539       formed on the remote host: the server is asked for a list  of  matching
540       files.   This  is  highly  dependent  on how the server is implemented,
541       though typically UNIX servers will provide support for basic glob  pat‐
542       terns.   This  may in some cases be faster, as it avoids retrieving the
543       entire list of directory contents.
544
545   Automatic and temporary reopening
546       As described for the zfopen command, a subsequent zfopen with no param‐
547       eters  will  reopen the connection to the last host (this includes con‐
548       nections made with the zfanon command).  Opened in  this  fashion,  the
549       connection  starts in the default remote directory and will remain open
550       until explicitly closed.
551
552       Automatic re-opening is also available.  If a connection  is  not  cur‐
553       rently  open  and  a  command requiring a connection is given, the last
554       connection is implicitly reopened.  In this case  the  directory  which
555       was  current  when  the connection was closed again becomes the current
556       directory (unless, of course, the command given changes it).  Automatic
557       reopening  will  also  take  place  if  the connection was close by the
558       remote server for whatever reason (e.g. a timeout).  It is  not  avail‐
559       able if the -1 option to zfopen or zfanon was used.
560
561       Furthermore,  if  the command issued is a file transfer, the connection
562       will be closed after  the  transfer  is  finished,  hence  providing  a
563       one-shot mode for transfers.  This does not apply to directory changing
564       or listing commands; for example a zfdir may reopen  a  connection  but
565       will  leave  it open.  Also, automatic closure will only ever happen in
566       the same command as automatic opening, i.e a zfdir directly followed by
567       a zfget will never close the connection automatically.
568
569       Information  about the previous connection is given by the zfstat func‐
570       tion.  So, for example, if that reports:
571
572              Session:        default
573              Not connected.
574              Last session:   ftp.bar.com:/pub/textfiles
575
576       then the command zfget file.txt will attempt to reopen a connection  to
577       ftp.bar.com, retrieve the file /pub/textfiles/file.txt, and immediately
578       close the connection again.  On the other hand, zfcd ..  will open  the
579       connection in the directory /pub and leave it open.
580
581       Note  that  all  the above is local to each session; if you return to a
582       previous session, the connection for that session is the one which will
583       be reopened.
584
585   Completion
586       Completion  of  local and remote files, directories, sessions and book‐
587       marks is supported.  The older,  compctl-style  completion  is  defined
588       when zfinit is called; support for the new widget-based completion sys‐
589       tem is provided in  the  function  Completion/Zsh/Command/_zftp,  which
590       should  be  installed with the other functions of the completion system
591       and hence should automatically be available.
592
593
594
595zsh 5.8                        February 14, 2020                 ZSHZFTPSYS(1)
Impressum