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.
Examples
url <- "ftp://ftp.ncbi.nlm.nih.gov/genomes/"
if (goalie::isAnExistingUrl(url)) {
x <- getUrlDirList(url)
print(x)
}
#> [1] "ASSEMBLY_REPORTS" "CLUSTERS"
#> [3] "GENOME_REPORTS" "HUMAN_MICROBIOM"
#> [5] "INFLUENZA" "MapView"
#> [7] "README.txt" "README_GFF3.txt"
#> [9] "README_assembly_summary.txt" "README_change_notice.txt"
#> [11] "TARGET" "TOOLS"
#> [13] "Viruses" "all"
#> [15] "archive" "check.txt"
#> [17] "genbank" "refseq"
#> [19] "species.diff.txt"