Debian Codegraph @

man/create.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/create.R
3 \name{create}
4 \alias{create}
5 \alias{file_create}
6 \alias{dir_create}
7 \alias{link_create}
8 \title{Create files, directories, or links}
9 \usage{
10 file_create(path, ..., mode = "u=rw,go=r")
11
12 dir_create(path, ..., mode = "u=rwx,go=rx", recurse = TRUE, recursive)
13
14 link_create(path, new_path, symbolic = TRUE)
15 }
16 \arguments{
17 \item{path}{A character vector of one or more paths. For \code{link_create()},
18 this is the target.}
19
20 \item{...}{Additional arguments passed to \code{\link[=path]{path()}}}
21
22 \item{mode}{If file/directory is created, what mode should it have?
23
24 Links do not have mode; they inherit the mode of the file they link to.}
25
26 \item{recurse}{should intermediate directories be created if they do not
27 exist?}
28
29 \item{recursive}{(Deprecated) If \code{TRUE} recurse fully.}
30
31 \item{new_path}{The path where the link should be created.}
32
33 \item{symbolic}{Boolean value determining if the link should be a symbolic
34 (the default) or hard link.}
35 }
36 \value{
37 The path to the created object (invisibly).
38 }
39 \description{
40 The functions \code{file_create()} and \code{dir_create()} ensure that \code{path} exists;
41 if it already exists it will be left unchanged. That means that compared to
42 \code{\link[=file.create]{file.create()}}, \code{file_create()} will not truncate an existing file, and
43 compared to \code{\link[=dir.create]{dir.create()}}, \code{dir_create()} will silently ignore existing
44 directories.
45 }
46 \examples{
47 \dontshow{.old_wd <- setwd(tempdir())}
48 file_create("foo")
49 is_file("foo")
50 # dir_create applied to the same path will fail
51 try(dir_create("foo"))
52
53 dir_create("bar")
54 is_dir("bar")
55 # file_create applied to the same path will fail
56 try(file_create("bar"))
57
58 # Cleanup
59 file_delete("foo")
60 dir_delete("bar")
61 \dontshow{setwd(.old_wd)}
62 }