This help topic is for R version 2.9.0. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/file.info.html
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.

On most systems symbolic links are followed, so information is given about the file to which the link points rather than about the link.

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, ‘last status change’ and last access times.

uid

integer: the user ID of the file's owner.

gid

integer: the group ID of the file's group.

uname

character: uid interpreted as a user name.

grname

character: gid interpreted as a group name.

Unknown user and group names will be NA.

Entries for non-existent or non-readable files will be NA. The uid, gid, uname and grname columns may not be supplied on a non-POSIX Unix system.

What is meant by the three file times depends on the OS and file system. On Windows ctime is the creation time.

Note

Some (broken) systems allow files of more than 2Gb to be created but not accessed by the stat system call. Such files will show up as non-readable (and very likely not be readable by any of R's input functions).

See Also

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

Sys.chmod to change permissions.

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.9.0 ]