Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

file_chmod

Change file permissions


Description

Change file permissions

Usage

file_chmod(path, mode)

Arguments

path

A character vector of one or more paths.

mode

A character representation of the mode, in either hexidecimal or symbolic format.

Details

Cross-compatibility warning: File permissions differ on Windows from POSIX systems. Windows does not use an executable bit, so attempting to change this will have no effect. Windows also does not have user groups, so only the user permissions (u) are relevant.

Examples

file_create("foo", mode = "000")
file_chmod("foo", "777")
file_info("foo")$permissions

file_chmod("foo", "u-x")
file_info("foo")$permissions

file_chmod("foo", "a-wrx")
file_info("foo")$permissions

file_chmod("foo", "u+wr")
file_info("foo")$permissions

# It is also vectorized
files <- c("foo", file_create("bar", mode = "000"))
file_chmod(files, "a+rwx")
file_info(files)$permissions

file_chmod(files, c("644", "600"))
file_info(files)$permissions

fs

Cross-Platform File System Operations Based on 'libuv'

v1.5.0
GPL-3
Authors
Jim Hester [aut, cre], Hadley Wickham [aut], libuv project contributors [cph] (libuv library), Joyent, Inc. and other Node contributors [cph] (libuv library), RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.