path_file("dir/file.zip")
path_dir("dir/file.zip")
path_ext("dir/file.zip")
path_ext("file.tar.gz")
path_ext_remove("file.tar.gz")
# Only one level of extension is removed
path_ext_set(path_ext_remove("file.tar.gz"), "zip")
Run the code above in your browser using DataLab