get_file_ext: Extract File Extension

View source: R/utils.R

get_file_extR Documentation

Extract File Extension

Description

Extract the extension of a file.

Usage

get_file_ext(x, compression = TRUE)

Arguments

x

'character' vector. File path(s).

compression

'logical' flag. Whether to account for the compression extension '.gz', '.bz2' or '.xz'.

Value

Returns the file (name) extensions (excluding the leading dot).

Author(s)

J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center

Examples

c("dir/file.txt", "file.txt.gz") |>
  get_file_ext()

inldata documentation built on Sept. 12, 2024, 9:34 a.m.