listFiles.Rd
List files in a registered directory or a subdirectory thereof. This will call the REST API if the caller is not on the same filesystem.
listFiles(path, url, forceRemote = FALSE)
Character vector of relative paths of files in path
.
# Starting up an example SewerRat service:
info <- startSewerRat()
# Mocking up a directory of stuff to query.
mydir <- tempfile()
dir.create(mydir)
write(file=file.path(mydir, "metadata.json"), '{ "first": "Aaron", "last": "Lun" }')
dir.create(file.path(mydir, "diet"))
write(file=file.path(mydir, "diet", "metadata.json"),
'{ "meal": "lunch", "ingredients": "water" }')
# Registering it:
register(mydir, "metadata.json", url=info$url)
# List files:
listFiles(mydir, url=info$url)
#> [1] "diet/metadata.json" "metadata.json"
listFiles(paste0(mydir, "/diet"), url=info$url)
#> [1] "metadata.json"
# Forcing remote access.
listFiles(mydir, url=info$url, forceRemote=TRUE)
#> [1] "diet/metadata.json" "metadata.json"