files2 {base} | R Documentation |
These functions provide a low-level interface to the computer's file system.
dir.create(path, showWarnings = TRUE, recursive = FALSE, mode = "0777") Sys.chmod(paths, mode = "0777") Sys.umask(mode = "0000")
path |
a character vector containing a single path name. |
paths |
character vectors containing file or directory paths. |
showWarnings |
logical; should the warnings on failure be shown? |
recursive |
logical. Should elements of the path other than the
last be created? If true, like Unix's mkdir -p . |
mode |
the file mode to be used on Unix-alikes: it will be
coerced by as.octmode . |
dir.create
creates the last element of the path, unless
recursive = TRUE
. Trailing path separators are removed.
On Windows drives are allowed in the path specification and unless
the path is rooted, it will be interpreted relative to the current
directory on that drive. mode
is ignored on Windows.
Sys.chmod
sets the file permissions of one or more files.
The interpretation of mode
in the Windows system function is
non-POSIX and only supports setting the read-only attribute of the
file. So R interprets mode
to mean set read-only if and only
if mode & 0200 == 0
(interpreted in octal). Windows has a much
more extensive system of file permissions on some file systems
(e.g. versions of NTFS) which are unrelated to this system call.
Sys.umask
sets the umask
.
All files on Windows are regarded as readable, and files being
executable is not a Windows concept. So umask
only controls
whether a file is writable: a setting of "200"
makes files (but
not directories) created subsequently read-only.
dir.create
and Sys.chmod
return invisibly a logical vector
indicating if the operation succeeded for each of the files attempted.
Using a missing value for a path name will always be regarded as a
failure. dir.create
indicates failure if the directory already
exists. If showWarnings = TRUE
, dir.create
will give a
warning for an unexpected failure (e.g. not for a missing value nor
for an already existing component for recursive = TRUE
).
Sys.umask
returns the previous value of the umask
,
invisibly, as a length-one object of class "octmode"
.
There is no guarantee that these functions will handle Windows relative paths of the form ‘d:path’: try ‘d:./path’ instead. In particular, ‘d:’ is not recognized as a directory.
Ross Ihaka, Brian Ripley
file.info
, file.exists
, file.path
,
list.files
, unlink
,
basename
, path.expand
.