Robust methods for setting file/folder permissions across multiple OS.
set_permissions(
path,
is_folder = FALSE,
permissions = list(Windows = "Everyone:(OI)(CI)RX", Mac = "u=rx,go=rx", Linux =
"u=rx,go=rx", default = "u=rx,go=rx"),
whoami = "admin",
pass = Sys.getenv("PASS"),
sudo = FALSE,
verbose = TRUE
)
Path to file/folder.
Whether path
is a folder.
If so, permissions will be set recursively for all files/subfolders.
Scope of permissions to set for each OS type. "default" is only used when the OS type is not Windows, Mac, or Linux.
Admin username.
Admin password.
Whether to run commands in sudo
mode.
Print messages.
f <- tempfile()
writeLines(text = letters, con = f)
set_permissions(f)
#> Setting permissions for file.
#> Setting owner with chown.