DirList: LidarIndexR - Retrieve a directory listing from a remote host

DirListR Documentation

LidarIndexR – Retrieve a directory listing from a remote host

Description

Retrieve a directory listing from a remote host as either a simple list of file/folder names or a data frame with file/folder information.

Usage

DirList(
  URL,
  fileType = NULL,
  namesOnly = FALSE,
  excludeDirectories = TRUE,
  directoryOnly = FALSE,
  dirFormat = "dir",
  ...
)

Arguments

URL

URL for a folder on a remote host. Trailing slash is optional.

fileType

Any valid string for the pattern parameter in grep(). "$" will be appended to the string to search for file/folder names ending with values in fileType.

namesOnly

Boolean indicating you want only file names (TRUE) or all directory information (FALSE).

excludeDirectories

Boolean indicating you want to exclude folders from the list of returned files/folders.

directoryOnly

Boolean indicating you only want folder names included in the list of returned files/folders.

dirFormat

String indicating the expected directory format for the URL. Valid values are "dir" if the URL returns the Date, Time, Attribute/Size, and file name; "ls" if the URL returns directory information similar to the UNIX ls -al command; or "" if you want the function to try to determine the directory format. This is ignored if the URL uses http or https schemes.

...

Arguments passed to RCurl::getURL(). This is ignored if the URL uses http or https schemes.

Value

A list of file names or a data frame with file names and attribute information. The return value depends on namesOnly.

Examples

## Not run: 
DirList("ftp://rockyftp.cr.usgs.gov/vdelivery/Datasets/Staged/")
DirList(paste0("ftp://rockyftp.cr.usgs.gov/vdelivery/Datasets/",
   "Staged/Elevation/LPC/Projects/AK_BrooksCamp_2012/laz/"),
    "\\.las|\\.laz")

## End(Not run)

bmcgaughey1/LidarIndexR documentation built on April 14, 2025, 6:07 p.m.