Description Usage Arguments Details Value See Also Examples
file_size takes a filepath and an optional regular
expression pattern. It returns the size of all files within that directory
which match the given pattern.
1 |
filepath |
A character string denoting a filepath. Defaults to the
working directory, |
pattern |
An optional character string denoting a
|
The sizes of files with certain extensions are returned with the
type of file prefixed. For example, the size of a 12 KB .xlsx file is
returned as 'Excel 12 KB'. The complete list of explicitly catered-for file
extensions and their prefixes are as follows:
.xls, .xlsb, .xlsm and .xlsx files are
prefixed with 'Excel'
.csv files are prefixed with 'CSV'
.sav and .zsav files are prefixed with 'SPSS'
.doc, .docm and .docx files are prefixed with
'Word'
.rds files are prefixed with 'RDS'
.txt files are prefixed with 'Text',
.fst files are prefixed with 'FST',
.pdf files are prefixed with 'PDF',
.tsv files are prefixed with 'TSV',
.html files are prefixed with 'HTML',
.ppt, .pptm and .pptx files are prefixed with
'PowerPoint',
.md files are prefixed with 'Markdown'
Files with extensions not contained within this list will have their size returned with no prefix. To request that a certain extension be explicitly catered for, please create an issue on GitHub.
File sizes are returned as the appropriate multiple of the unit byte (bytes (B), kilobytes (KB), megabytes (MB), etc.). Each multiple is taken to be 1,024 units of the preceding denomination.
A tibble listing the names of files within
filepath which match pattern and their respective sizes. The
column names of this tibble are 'name' and 'size'. If no pattern is
specified, file_size returns the names and sizes of all files within
filepath. File names and sizes are returned in alphabetical order of
file name. Sub-folders contained within filepath will return a file
size of '0 B'.
If filepath is an empty folder, or pattern matches no files
within filepath, file_size returns NULL.
For more information on using regular expressions, see this
Jumping Rivers blog post
and this
vignette
from the stringr package.
1 2 3 4 5 6 7 8 9 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.