This function trims extensions from a file name.
trim_ext(x, n)
x
a character or a filename
character
filename
n
number of extensions to trim off the end
modified object of the original type
x <- "path/data.txt.gz" print(trim_ext(x))