File extension
Usage
fileExt(path, pattern = goalie::extPattern)
Arguments
- path
character
. File path(s). This function is vectorized and supports multiple files.- pattern
character(1)
. File extension pattern.
Value
character
.
Character vector of same length as path
input, with file extension removed.
Returns NA
if no extension is detected.
See also
tools::file_ext()
. Note that this returns character()
instead of NA
on extension match failure.
Examples
fileExt(c("dir/foo.txt", "dir/bar.tar.gz", "dir/"))
#> [1] "txt" "tar.gz" NA