
Get the size of each file
file_size.Rd
This function takes a vector of file paths and returns a data frame with the file name and size of each file. File sizes can be reported in different units (bytes, kilobytes, megabytes, gigabytes). A file will have a size of NA if and only if, the file doesn't exists.
Arguments
- files
A vector of file paths.
- units
The desired file size unit:
'bytes'
(the default),'kb'
,'mb'
, or'gb'
.
Value
A data frame with the following properties:
Has as many rows as
files
.Has two columns:
filename
(identical tofiles
) andsize
(in the desiredunits
).
Examples
if (FALSE) {
file_size(c("file1.txt", "file2.txt"), units = 'kb')
}