Debian Codegraph @

man/path_file.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/path.R
3 \name{path_file}
4 \alias{path_file}
5 \alias{path_dir}
6 \alias{path_ext}
7 \alias{path_ext_remove}
8 \alias{path_ext_set}
9 \alias{path_ext<-}
10 \title{Manipulate file paths}
11 \usage{
12 path_file(path)
13
14 path_dir(path)
15
16 path_ext(path)
17
18 path_ext_remove(path)
19
20 path_ext_set(path, ext)
21
22 path_ext(path) <- value
23 }
24 \arguments{
25 \item{path}{A character vector of one or more paths.}
26
27 \item{ext, value}{The new file extension.}
28 }
29 \description{
30 \itemize{
31 \item \code{path_file()} returns the filename portion of the path
32 \item \code{path_dir()} returns the directory portion of the path
33 \item \code{path_ext()} returns the last extension (if any) for a path
34 \item \code{path_ext_remove()} removes the last extension and returns the rest of
35 the path
36 \item \code{path_ext_set()} replaces the extension with a new extension. If there is
37 no existing extension the new extension is appended
38 }
39 }
40 \details{
41 Note because these are not full file paths they return regular character
42 vectors, not \code{\link[=fs_path]{fs_path}} objects.
43 }
44 \examples{
45 path_file("dir/file.zip")
46
47 path_dir("dir/file.zip")
48
49 path_ext("dir/file.zip")
50
51 path_ext("file.tar.gz")
52
53 path_ext_remove("file.tar.gz")
54
55 # Only one level of extension is removed
56 path_ext_set(path_ext_remove("file.tar.gz"), "zip")
57 }
58 \seealso{
59 \code{\link[base:basename]{base::basename()}}, \code{\link[base:basename]{base::dirname()}}
60 }