Previous: HTTP Time-Stamping Internals, Up: Time-Stamping



5.3 FTP Time-Stamping Internals

In theory, ftp time-stamping works much the same as http, only ftp has no headers—time-stamps must be ferreted out of directory listings.

If an ftp download is recursive or uses globbing, Wget will use the ftp LIST command to get a file listing for the directory containing the desired file(s). It will try to analyze the listing, treating it like Unix ls -l output, extracting the time-stamps. The rest is exactly the same as for http. Note that when retrieving individual files from an ftp server without using globbing or recursion, listing files will not be downloaded (and thus files will not be time-stamped) unless -N is specified.

Assumption that every directory listing is a Unix-style listing may sound extremely constraining, but in practice it is not, as many non-Unix ftp servers use the Unixoid listing format because most (all?) of the clients understand it. Bear in mind that rfc959 defines no standard way to get a file list, let alone the time-stamps. We can only hope that a future standard will define this.

Another non-standard solution includes the use of MDTM command that is supported by some ftp servers (including the popular wu-ftpd), which returns the exact time of the specified file. Wget may support this command in the future.