Utilities enhancing basename()
basename_extended.Rd
Utilities for getting name of files and extension in another whay than of `tools::file_ext()`` and others corresponding functions.
Details
basename_core()`` differs from
tools::file_path_sans_ext()` in this:
basename()
is first applied"compounded" extensions are removed. See examples.
basename_ext()
differs from tools::file_path_sans_ext()
in this:
basename()
is first applied"compounded" extensions are extracted. See examples.
Examples
# equivalent to tools::file_path_sans_ext
basename_core("toto.7z")
#> [1] "toto"
# different from tools::file_path_sans_ext
basename_core("toto.7z.001")
#> [1] "toto"
basename_core("path/toto.csv")
#> [1] "toto"
basename_core("path/toto.csv.gz")
#> [1] "toto"
# equivalent to tools::file__ext
basename_ext("toto.7z")
#> [1] "7z"
basename_ext("path/toto.csv")
#> [1] "csv"
#'different from tools::file__ext
basename_ext("toto.7z.001")
#> [1] "7z.001"
basename_ext("path/toto.csv.gz")
#> [1] "csv.gz"