Skip to contents

Get Extension of Full File Paths

Usage

fileExtension(x)

Arguments

x

vector of file paths

Examples

# Define example paths
paths <- c("C:/example/file.csv", "file2.txt", "D:/e/f/ghi.jkl.zip")

# Get the file name extensions
fileExtension(paths)
#> [1] "csv" "txt" "zip"

# Empty string is returned for paths without file name extensions
fileExtension("C:/NEWS")
#> [1] ""