Change file permissions
file_chmod(path, mode)
path | A character vector of one or more paths. |
---|---|
mode | A character representation of the mode, in either hexidecimal or symbolic format. |
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.
.old_wd <- setwd(tempdir()) file_create("foo", mode = "000") file_chmod("foo", "777") file_info("foo")$permissions#> [1] rwxrwxrwx#> [1] rw-rwxrwx#> [1] ---------#> [1] rw-------# It is also vectorized files <- c("foo", file_create("bar", mode = "000")) file_chmod(files, "a+rwx") file_info(files)$permissions#> [1] rwxrwxrwx rwxrwxrwx#> [1] rw-r--r-- rw-------setwd(.old_wd)