Takes a file path and converts it to its directory path by
dropping the file name and extension. If flpth
is already a directory
path, the argument will be returned unchanged. If nothing is provided,
nothing is returned (i.e. character(0)
).
dirpath_get(flpth)
flpth | File path for which directory path will be returned. |
---|
Character
library(outsider.base) # get the parent directory from a filepath drpth <- tempdir() flpth <- file.path(drpth, 'testfile') file.create(flpth)#> [1] TRUE(dirpath_get(flpth = flpth) == drpth)#> [1] FALSE(dirpath_get(flpth = drpth) == drpth)#> [1] TRUE#> [1] TRUE