List files associated with a shapefile

shp_list_files(file, ext = shp_extensions(), exists = TRUE)

shp_delete(file, ext = shp_extensions())

shp_copy(file, to, ext = shp_extensions(), overwrite = FALSE)

shp_move(file, to, ext = shp_extensions(), overwrite = FALSE)

shp_assert(file)

shp_extensions()

Arguments

file

A .shp file

ext

One or more extensions to include

exists

Use FALSE to generate hypothetical shapefile names.

to

Destination: a .shp filename the same length as to or a single directory.

overwrite

Use TRUE to

Value

A list of files of length length(file) * length(ext).

Examples

shp_assert(shp_example_all()) shp_list_files(shp_example("anno.shp"))
#> [1] "/Users/runner/work/_temp/Library/shp/shp/anno.shp" #> [2] "/Users/runner/work/_temp/Library/shp/shp/anno.shx" #> [3] "/Users/runner/work/_temp/Library/shp/shp/anno.dbf" #> [4] "/Users/runner/work/_temp/Library/shp/shp/anno.aux"
dest <- tempfile() dir.create(dest) shp_copy(shp_example("anno.shp"), dest) list.files(dest)
#> [1] "anno.aux" "anno.dbf" "anno.shp" "anno.shx"
shp_move(file.path(dest, "anno.shp"), file.path(dest, "anno1.shp")) list.files(dest)
#> [1] "anno1.aux" "anno1.dbf" "anno1.shp" "anno1.shx"
shp_delete(file.path(dest, "anno1.shp")) list.files(dest)
#> character(0)
unlink(dest, recursive = TRUE)