| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/file.R |
| 3 |
\name{file_chmod} |
| 4 |
\alias{file_chmod} |
| 5 |
\title{Change file permissions} |
| 6 |
\usage{ |
| 7 |
file_chmod(path, mode) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{path}{A character vector of one or more paths.} |
| 11 |
|
| 12 |
\item{mode}{A character representation of the mode, in either hexidecimal or symbolic format.} |
| 13 |
} |
| 14 |
\description{ |
| 15 |
Change file permissions |
| 16 |
} |
| 17 |
\details{ |
| 18 |
\strong{Cross-compatibility warning:} File permissions differ on Windows |
| 19 |
from POSIX systems. Windows does not use an executable bit, so attempting |
| 20 |
to change this will have no effect. Windows also does not have user |
| 21 |
groups, so only the user permissions (\code{u}) are relevant. |
| 22 |
} |
| 23 |
\examples{ |
| 24 |
\dontshow{.old_wd <- setwd(tempdir())} |
| 25 |
file_create("foo", mode = "000") |
| 26 |
file_chmod("foo", "777") |
| 27 |
file_info("foo")$permissions |
| 28 |
|
| 29 |
file_chmod("foo", "u-x") |
| 30 |
file_info("foo")$permissions |
| 31 |
|
| 32 |
file_chmod("foo", "a-wrx") |
| 33 |
file_info("foo")$permissions |
| 34 |
|
| 35 |
file_chmod("foo", "u+wr") |
| 36 |
file_info("foo")$permissions |
| 37 |
|
| 38 |
# It is also vectorized |
| 39 |
files <- c("foo", file_create("bar", mode = "000")) |
| 40 |
file_chmod(files, "a+rwx") |
| 41 |
file_info(files)$permissions |
| 42 |
|
| 43 |
file_chmod(files, c("644", "600")) |
| 44 |
file_info(files)$permissions |
| 45 |
\dontshow{setwd(.old_wd)} |
| 46 |
} |