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

MISCELLANEOUS FEATURES

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