[file.info] the full results of a
stat(2) system call are
returned and some columns are returned as S3 classes to make manipulation
more natural. On systems which do not support all metadata (such as Windows)
default values are used.
file_info(path, fail = TRUE, follow = FALSE) file_size(path, fail = TRUE)
A character vector of one or more paths.
Should the call fail (the default) or warn if a file cannot be accessed.
A data.frame with metadata for each file. Columns returned are as follows.
The input path, as a
fs_path() character vector.
The file type, as a factor of file types.
The file size, as a
fs_bytes() numeric vector.
The file permissions, as a
fs_perms() integer vector.
The time of last data modification, as a POSIXct datetime.
The file owner name - as a character vector.
The file group name - as a character vector.
The file device id - as a numeric vector.
The number of hard links to the file - as a numeric vector.
The special device id of the file - as a numeric vector.
The inode of the file - as a numeric vector.
The optimal block for the file - as a numeric vector.
The number of blocks allocated for the file - as a numeric vector.
The user defined flags for the file - as an integer vector.
The generation number for the file - as a numeric vector.
The time of last access - as a POSIXct datetime.
The time of last file status change - as a POSIXct datetime.
The time when the inode was created - as a POSIXct datetime.
dir_info() to display file information for files in a given
#> # A tibble: 1 x 18 #> path type size permissions modification_time user group device_id #> <fs::path> <fct> <fs:> <fs::perms> <dttm> <chr> <chr> <dbl> #> 1 mtcars.csv file 1.74K rw-rw-rw- 2020-07-31 20:54:31 runn… staff 16777223 #> # … with 10 more variables: hard_links <dbl>, special_device_id <dbl>, #> # inode <dbl>, block_size <dbl>, blocks <dbl>, flags <int>, generation <dbl>, #> # access_time <dttm>, change_time <dttm>, birth_time <dttm># Files in the working directory modified more than 20 days ago files <- file_info(dir_ls()) files$path[difftime(Sys.time(), files$modification_time, units = "days") > 20]#> character(0)