tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ftp(1) check for file existence only (PATCH included)

On Thu, Mar 13, 2008 at 08:46:49PM -0500, Jeremy C. Reed wrote:
  | This has not tested with other options but this does what I need.
  | From my changed man page:
  |      -h          Check for file and do not download.  For FTP it does an ls.
  |                  For HTTP it does a HEAD request.
  | Maybe renamed to -c?
  | I thought I needed this so I can check for existence of pkg_summary 
  | file(s).
  | Now I realize I didn't need this, I want to download pkg_summary so I was 
  | going to test for existence for different pkgsrc branches (directories) 
  | but now I realize I could have just downloaded and if that errored then 
  | try an older branch location ... anyways I still have the following 
  | patch. What do you think?
  | curl uses -I switch to do this.

I like the concept, although the implementation could do with some

 * Possibly use -I, a la curl.  

 * Explicitly return a non-zero exit code if the file doesn't exist.

   I think this will be the case for http fetches, and possibly
   for all proxied fetches.

   This can be difficult when using LIST (for the "long" listing),
   because remote servers may just return an empty file list
   and a 226 reply.
   Maybe try using MLST if available, or just check that at least
   1 line of reply was found?


Attachment: pgpshE07tKGXY.pgp
Description: PGP signature

Home | Main Index | Thread Index | Old Index