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