get_file_ext {inldata}R 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()

[Package inldata version 1.2.3 Index]