getExtension: Extract file name, extension and basename ofrom a path.é

View source: R/getExtension.R

getExtensionR Documentation

Extract file name, extension and basename ofrom a path.é

Description

Extract file name, extension and basename ofrom a path.é

Usage

getExtension(x, sep = .Platform$file.sep)

getFilename(x, sep = .Platform$file.sep)

getName(x, sep = .Platform$file.sep)

getBasename(x, sep = .Platform$file.sep)

getLocation(x, sep = .Platform$file.sep)

getDetails(x, sep = .Platform$file.sep)

Arguments

x

a character string. Note that getDetails() also supports vector of paths.

sep

file separator, default used the platform-specific file separator see .Platform().

Details

For more functionalities, have a look at package fs.

Value

Extract the file extension a character string (e.g. a path).

Functions

  • getFilename(): Extract the file name from a character string, that is the base name and the file extension

  • getName(): Extract the name of a file or a directory from a character string.

  • getBasename(): Extract the base name of a file from a character string.

  • getLocation(): Extract the location of the parent folfder from a character string.

  • getDetails(): Return a data frame with basic information for all elements of a vector of paths.

Examples

getExtension("path1/path2/foo.R")
getFilename("path1/path2/foo.R")
getBasename("path1/path2/foo.R")
getLocation("path1/path2/foo.R")
getDetails("path1/path2/foo.R")
getDetails(list.files(recursive = TRUE)) 
getExtension("foo.R")
getBasename("foo.R")

inSileco/inSilecoMisc documentation built on Sept. 14, 2022, 5:44 a.m.