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       this requires version 5 of perl, see the description  of  the  function
197       zfrtime below for more information.
198
199       zfget [ -Gtc ] file1 ...
200              Retrieve  all  the listed files file1 ... one at a time from the
201              remote server.  If a file contains  a  `/',  the  full  name  is
202              passed  to  the  remote  server,  but the file is stored locally
203              under the name given by the  part  after  the  final  `/'.   The
204              option  -c  (cat) forces all files to be sent as a single stream
205              to standard output; in this case the -t option has no effect.
206
207       zfuget [ -Gvst ] file1 ...
208              As zfget, but only retrieve  files  where  the  version  on  the
209              remote server is newer (has a later modification time), or where
210              the local file does not exist.  If the remote file is older  but
211              the files have different sizes, or if the sizes are the same but
212              the remote file is newer, the  user  will  usually  be  queried.
213              With  the  option  -s, the command runs silently and will always
214              retrieve the file in either of those two cases.  With the option
215              -v, the command prints more information about the files while it
216              is working out whether or not to transfer them.
217
218       zfcget [ -Gt ] file1 ...
219              As zfget, but if any of the local files exists, and  is  shorter
220              than  the corresponding remote file, the command assumes that it
221              is the result of a partially completed transfer and attempts  to
222              transfer the rest of the file.  This is useful on a poor connec‐
223              tion which keeps failing.
224
225              Note that this requires a commonly  implemented,  but  non-stan‐
226              dard,  version of the FTP protocol, so is not guaranteed to work
227              on all servers.
228
229       zfgcp [ -Gt ] remote-file local-file
230       zfgcp [ -Gt ] rfile1 ... ldir
231              This retrieves files  from  the  remote  server  with  arguments
232              behaving similarly to the cp command.
233
234              In the first form, copy remote-file from the server to the local
235              file local-file.
236
237              In the second form, copy all the remote files  rfile1  ...  into
238              the  local  directory  ldir  retaining the same basenames.  This
239              assumes UNIX directory semantics.
240
241   Sending files
242       zfput [ -r ] file1 ...
243              Send all the file1 ... given separately to  the  remote  server.
244              If  a filename contains a `/', the full filename is used locally
245              to find the file, but only the basename is used for  the  remote
246              file name.
247
248              With the option -r, if any of the files are directories they are
249              sent recursively with all their subdirectories, including  files
250              beginning  with  `.'.   This  requires  that  the remote machine
251              understand UNIX file semantics, since `/' is used as a directory
252              separator.
253
254       zfuput [ -vs ] file1 ...
255              As  zfput,  but only send files which are newer than their local
256              equivalents, or if the remote file does not exist.  The logic is
257              the  same  as  for zfuget, but reversed between local and remote
258              files.
259
260       zfcput file1 ...
261              As zfput, but if any remote file already exists and  is  shorter
262              than  the local equivalent, assume it is the result of an incom‐
263              plete transfer and send the rest of the file to  append  to  the
264              existing  part.   As the FTP append command is part of the stan‐
265              dard set, this is in principle more likely to work than zfcget.
266
267       zfpcp local-file remote-file
268       zfpcp lfile1 ... rdir
269              This sends files to the remote server  with  arguments  behaving
270              similarly to the cp command.
271
272              With   two   arguments,   copy   local-file  to  the  server  as
273              remote-file.
274
275              With more than two arguments, copy all the  local  files  lfile1
276              ...  into  the existing remote directory rdir retaining the same
277              basenames.  This assumes UNIX directory semantics.
278
279              A problem arises if you attempt to use zfpcp lfile1  rdir,  i.e.
280              the  second  form of copying but with two arguments, as the com‐
281              mand has no simple way of  knowing  if  rdir  corresponds  to  a
282              directory or a filename.  It attempts to resolve this in various
283              ways.  First, if the rdir argument is `.' or `..' or ends  in  a
284              slash, it is assumed to be a directory.  Secondly, if the opera‐
285              tion of copying to a remote file in the first form  failed,  and
286              the remote server sends back the expected failure code 553 and a
287              reply including the string `Is a  directory',  then  zfpcp  will
288              retry using the second form.
289
290   Closing the connection
291       zfclose
292              Close the connection.
293
294   Session management
295       zfsession [ -lvod ] [ sessname ]
296              Allows you to manage multiple FTP sessions at once.  By default,
297              connections take place in a session called `default'; by  giving
298              the  command  `zfsession  sessname'  you  can change to a new or
299              existing session with a name of your choice.   The  new  session
300              remembers its own connection, as well as associated shell param‐
301              eters, and also the host/user parameters set by zfparams.  Hence
302              you  can  have different sessions set up to connect to different
303              hosts, each remembering the appropriate host, user and password.
304
305              With no arguments, zfsession prints the name of the current ses‐
306              sion;  with  the option -l it lists all sessions which currently
307              exist, and with the option -v it gives a  verbose  list  showing
308              the  host and directory for each session, where the current ses‐
309              sion is marked with an asterisk.  With -o, it will switch to the
310              most recent previous session.
311
312              With -d, the given session (or else the current one) is removed;
313              everything to do with it is completely forgotten.  If it was the
314              only session, a new session called `default' is created and made
315              current.  It is safest not to delete sessions  while  background
316              commands using zftp are active.
317
318       zftransfer sess1:file1 sess2:file2
319              Transfer files between two sessions; no local copy is made.  The
320              file is read from the session sess1 as file1 and written to ses‐
321              sion sess2 as file file2; file1 and file2 may be relative to the
322              current directories of the session.  Either sess1 or  sess2  may
323              be  omitted  (though  the colon should be retained if there is a
324              possibility of a colon appearing in the file name) and  defaults
325              to  the  current session; file2 may be omitted or may end with a
326              slash, in which case the basename of file1 will be  added.   The
327              sessions sess1 and sess2 must be distinct.
328
329              The  operation  is performed using pipes, so it is required that
330              the connections still be valid in a subshell, which is  not  the
331              case under versions of some operating systems, presumably due to
332              a system bug.
333
334   Bookmarks
335       The two functions zfmark and zfgoto allow you to `bookmark' the present
336       location  (host,  user and directory) of the current FTP connection for
337       later use.  The file to be used for storing and retrieving bookmarks is
338       given  by  the  parameter  $ZFTP_BMFILE; if not set when one of the two
339       functions is called, it will be set  to  the  file  .zfbkmarks  in  the
340       directory where your zsh startup files live (usually ~).
341
342       zfmark [ bookmark ]
343              If  given an argument, mark the current host, user and directory
344              under the name bookmark for later use by zfgoto.  If there is no
345              connection  open, use the values for the last connection immedi‐
346              ately before it was closed; it is an error if  there  was  none.
347              Any  existing  bookmark  under  the  same  name will be silently
348              replaced.
349
350              If not given an argument, list the existing  bookmarks  and  the
351              points to which they refer in the form user@host:directory; this
352              is the format in which they are stored,  and  the  file  may  be
353              edited directly.
354
355       zfgoto [ -n ] bookmark
356              Return  to  the location given by bookmark, as previously set by
357              zfmark.  If the location has user `ftp' or `anonymous', open the
358              connection with zfanon, so that no password is required.  If the
359              user and host parameters match those stored for the current ses‐
360              sion,  if  any,  those  will  be  used, and again no password is
361              required.  Otherwise a password will be prompted for.
362
363              With the option -n, the bookmark  is  taken  to  be  a  nickname
364              stored  by  the  ncftp  program  in  its bookmark file, which is
365              assumed to be ~/.ncftp/bookmarks.  The  function  works  identi‐
366              cally in other ways.  Note that there is no mechanism for adding
367              or modifying ncftp bookmarks from the zftp functions.
368
369   Other functions
370       Mostly, these  functions  will  not  be  called  directly  (apart  from
371       zfinit),  but  are  described  here  for completeness.  You may wish to
372       alter zftp_chpwd and zftp_progress, in particular.
373
374       zfinit [ -n ]
375              As described above, this is used to initialize the zftp function
376              system.   The  -n  option  should be used if the zftp command is
377              already built into the shell.
378
379       zfautocheck [ -dn ]
380              This function is called to implement automatic reopening  behav‐
381              iour,  as  described  in  more  detail  below.  The options must
382              appear in the first  argument;  -n  prevents  the  command  from
383              changing to the old directory, while -d prevents it from setting
384              the variable do_close, which it otherwise does  as  a  flag  for
385              automatically closing the connection after a transfer.  The host
386              and directory for the last session are stored  in  the  variable
387              $zflastsession,  but  the internal host/user/password parameters
388              must also be correctly set.
389
390       zfcd_match prefix suffix
391              This performs matching for completion of remote directory names.
392              If  the  remote  server is UNIX, it will attempt to persuade the
393              server to list the remote directory with subdirectories  marked,
394              which  usually  works  but is not guaranteed.  On other hosts it
395              simply calls zfget_match and hence completes all files, not just
396              directories.   On  some  systems,  directories may not even look
397              like filenames.
398
399       zfget_match prefix suffix
400              This performs matching for completion of remote  filenames.   It
401              caches  files  for  the  current  directory  (only) in the shell
402              parameter $zftp_fcache.  It is in the form to be called  by  the
403              -K  option  of  compctl,  but also works when called from a wid‐
404              get-style completion function with prefix and suffix set  appro‐
405              priately.
406
407       zfrglob varname
408              Perform  remote  globbing,  as  describes  in more detail below.
409              varname is the name of a variable containing the pattern  to  be
410              expanded;  if  there were any matches, the same variable will be
411              set to the expanded set of filenames on return.
412
413       zfrtime lfile rfile [ time ]
414              Set the local file lfile to have the same modification  time  as
415              the  remote  file rfile, or the explicit time time in FTP format
416              CCYYMMDDhhmmSS for the GMT timezone.
417
418              Currently this requires perl version 5 to perform the conversion
419              from  GMT  to local time.  This is unfortunately difficult to do
420              using shell code alone.
421
422       zftp_chpwd
423              This function is called every time a connection  is  opened,  or
424              closed,  or  the  remote directory changes.  This version alters
425              the title bar of an xterm-compatible or sun-cmd terminal  emula‐
426              tor to reflect the local and remote hostnames and current direc‐
427              tories.  It works best when combined with  the  function  chpwd.
428              In particular, a function of the form
429
430                     chpwd() {
431                       if [[ -n $ZFTP_USER ]]; then
432                         zftp_chpwd
433                       else
434                         # usual chpwd e.g put host:directory in title bar
435                       fi
436                     }
437
438              fits in well.
439
440       zftp_progress
441              This  function  shows  the  status of the transfer.  It will not
442              write anything unless the output is going to  a  terminal;  how‐
443              ever,  if  you transfer files in the background, you should turn
444              off progress reports by hand using  `zstyle  ':zftp:*'  progress
445              none'.   Note  also  that if you alter it, any output must be to
446              standard error, as standard output may be a file being received.
447              The  form  of  the progress meter, or whether it is used at all,
448              can be configured without altering the function, as described in
449              the next section.
450
451       zffcache
452              This is used to implement caching of files in the current direc‐
453              tory for each session separately.  It is used by zfget_match and
454              zfrglob.
455

MISCELLANEOUS FEATURES

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