1. dir.create() 函数 可以设置 chmod 权限
dir.create(path, showWarnings = TRUE, recursive = FALSE, mode = "0777")
Sys.chmod(paths, mode = "0777", use_umask = TRUE)
Sys.umask(mode = NA)
Sys.chmod(list.dirs("."), "777")
f <- list.files(".", all.files = TRUE, full.names = TRUE, recursive TRUE)
Sys.chmod(f, (file.info(f)$mode | "664"))
2. unlink 删除目录
unlink('data', recursive = TRUE, force = FALSE)
3. file 文件操作
if(file.exists('data')) {
+ print(1)
+ }
file.remove() 不能匹配正则...
file.path
4. 文件追加
write.table("y", file = "1.txt", append = TRUE, quote = TRUE, sep = " ",
+ eol = "\n", na = "NA", dec = ".", row.names = F,
+ col.names = F, qmethod = c("escape", "double"),
+ fileEncoding = "")