Extract File Extension
Extract the extension of a file.
get_file_ext(x, compression = TRUE)
x
: 'character' vector. File path(s).compression
: 'logical' flag. Whether to account for the compression extension '.gz', '.bz2' or '.xz'.Returns the file (name) extensions (excluding the leading dot).
c("dir/file.txt", "file.txt.gz") |> get_file_ext()
J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center
Useful links