Skip to Content

file.info {base}

Extract File Information
Package: 
base
Version: 
R 2.15.3

Description

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

Usage

file.info(...)

Arguments

...
character vectors containing file paths. Tilde-expansion is done: see path.expand.

Details

What constitutes a ‘file’ is OS-dependent but includes directories. (However, directory names must not include a trailing backslash or slash on Windows.) See also the section in the help for file.exists on case-insensitive file systems.

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.

Values

A data frame with row names the file names and columns

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

What is meant by the three file times depends on the OS and file system. On Windows native file systems ctime is the file creation time (something which is not recorded on most Unix-alike file systems). What is meant by ‘file access’ and hence the ‘last access time’ is system-dependent. The times are reported to an accuracy of seconds, and perhaps more on some systems. However, many file systems only record times in seconds, and some (e.g. modification time on FAT systems) are recorded in increments of 2 or more seconds.

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.

See Also

Sys.readlink to find out about symbolic links, 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## End(Not run)
 
## 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")

Documentation reproduced from R 2.15.3. License: GPL-2.