file.info {base}R Documentation

Extract File Information

Description

Utility function to extract information about files on the user's file systems.

Usage

file.info(...)

Arguments

... character vectors containing file paths.

Details

The file paths are tilde-expanded: see path.expand.

What is meant by ‘file access’ and hence the last access time is system-dependent.

The file ‘mode’ follows POSIX conventions, giving three octal digits summarizing the permissions for the file owner, the owner's group and for anyone respectively. Each digit is the logical or of read (4), write (2) and execute/search (1) permissions.

File modes are probably only useful on NTFS file systems, and it seems all three digits refer to the file's owner. The execute/search bits are set for directories, and for files based on their extensions (e.g. .exe, .com, .cmd and .bat files). file.access will give a more reliable view of read/write access availability to the R process.

Value

A data frame with row names the file names and columns

size double: File size in bytes.
isdir logical: Is the file a directory?
mode integer of class "octmode". The file permissions, printed in octal, for example 644.
mtime, ctime, atime integer of class "POSIXct": file modification, creation and last access times.
exe character: what sort of executable is this? Possible values are "no", "msdos", "win16", "win32", "win64" and "unknown". Note that a file (e.g. a script file) can be executable according to the mode bits but not executable in this sense.


Entries for non-existent or non-readable files will be NA.

See Also

files, file.access, list.files, and DateTimeClasses for the date formats.

Examples

ncol(finf <- file.info(dir()))# at least six
## Not run: finf # the whole list
## Those that are more than 100 days old :
finf[difftime(Sys.time(), finf[,"mtime"], units="days") > 100 , 1:4]

file.info("no-such-file-exists")

[Package base version 2.6.2 Index]