ftp_parseMeta: Parse ftp return from getURL call with no options

View source: R/ftp_parseMeta.R

ftp_parseMetaR Documentation

Parse ftp return from getURL call with no options

Description

Parse ftp return from getURL call with no options

Usage

ftp_parseMeta(ret)

Arguments

ret

(required) A character vector; the return from a call to getURL with no options.

Details

The expected input assumes that getURL is called with the bare minimum options, i.e. only url and, if necessary, userpwd. Since there is no input checking, this function handles un-parse-able inputs by returning the input as-is.

Value

If at least one field in ret was parsed, a data.table containing eight fields, plus the input (so nine total). Fields include:

  • original (chr); the original input, for reference

  • permissions (chr); flags denoting various access and modification parameters, unparsed.

  • type_code (int); the type of asset. Typically, 1 denotes a file, while 2 a directory

  • owner_group (chr); a space-delimited vector denoting the owner and group

  • size (dbl); for a file, the size in bytes. This may not be meaningful for directories.

  • name (chr); the name of the asset; if a file, will include the extension.

  • mod_time (chr); the time of the mod_date

  • mod_date (chr); the date, possibly only the three-letter month, space date (of month) if the last modification date is less than 6 months from the current date (of the endpoint).

  • mod_year (int): the last modified year. This information is not included for files that are created in the current year, and so is inferred in such cases to the current year.

If ret could not be parsed at all, i.e. if all NA, then the input is returned as-is, with a warning.

See Also

Other ftp_functions: ftp_getBinPars(), ftp_listDir(), ftp_makeParams()

Examples

## Not run: 
library(RCurl)
# get basic metadata from an ftp endpoint
my_params <- ftp_makeParams(host = "ftp.123.com", user = "myself", pwd = "my_pwd")
my_meta   <- do.call(getURL, my_params)
ftp_parseMeta(my_meta)

## End(Not run)

slin30/wzMisc documentation built on Jan. 27, 2023, 1 a.m.