dir_contents | R Documentation |
These functions give information about the size of directories as well as the number of files and sub-directories they contain (both in the immediate directory and recursively over sub-directories).
dir_contents()
returns a data frame with rows for each directory or sub-directories.
dir_size()
, dir_count_files()
and dir_count_dirs()
return atomic vectors of, respectively,
the size, the number of files, and the number of directories in dir
. All information
returned by these functions is included in the output of dir_contents()
, but they may be useful
for simplicity or speed.
dir_contents(dir = ".", recurse = TRUE, ..., shorten = TRUE)
dir_size(dir = ".", recurse = TRUE, ...)
dir_count_files(dir = ".", recurse = TRUE, ...)
dir_count_dirs(dir = ".", recurse = TRUE, ...)
dir |
A character vector of directory paths. For |
recurse |
Passed to |
... |
Additional arguments passed to |
shorten |
If |
dir_size()
returns an fs_bytes vector.
dir_count_files()
and dir_count_dirs()
each return integer vectors.
dir_contents()
returns a data frame with columns:
directory |
The path of the directory as an |
level |
The level of the directory relative to |
total_size |
The total size of all files in the directory, including sub-directories. |
total_files |
The total number of all files in the directory, including sub-directories. |
total_dirs |
The total number of all directories in the directory (fully recursive). |
files_size |
The total size of all files in the immediate directory (not sub-directories). |
num_files |
The number of files in the immediate directory. |
num_dirs |
The number of immediate sub-directories of the directory. |
All size columns are fs_bytes numeric vectors.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.