getUrlDirList: Get remote URL directory listing

View source: R/getUrlDirList.R

getUrlDirListR Documentation

Get remote URL directory listing

Description

Get remote URL directory listing

Usage

getUrlDirList(
  url,
  type = c("all", "dirs", "files"),
  pattern = NULL,
  absolute = FALSE
)

Arguments

url

character(1). Uniform Resource Locator (URL).

type

character(1). Type of files to return:

  • "all": Both directories and files.

  • "dirs": Directories only.

  • "files": Files only.

pattern

character(1). Regular expression pattern to use for matching. Only matches against the basename of the URL.

absolute

logical(1). Return absolute path.

Details

FTP and HTTP(S) servers are supported. Designed to be simple, and does not support recursive directory listing.

Value

character. File basename, or absolute URL path when absolute is TRUE.

Note

Updated 2023-09-28.

See Also

  • curlGetHeaders.

Examples

url <- "ftp://ftp.ncbi.nlm.nih.gov/genomes/"
if (goalie::isAnExistingUrl(url)) {
    x <- getUrlDirList(url)
    print(x)
}

steinbaugh/brio documentation built on Feb. 1, 2024, 6:42 p.m.