write_manifest_from_dir: Generate a file manifest from a directory of local files.

View source: R/manifest.R

write_manifest_from_dirR Documentation

Generate a file manifest from a directory of local files.

Description

Create a manifest (CSV file) that describes all files in the given directory. This is meant to remove the tedious manual work of adding many files to a package: put the files into a directory (subdirectories are preserved), run this function once, and a ready-to-use manifest is written. The MD5 checksum of every file is computed automatically.

Usage

write_manifest_from_dir(dir, out, url_base = NULL)

Arguments

dir

string. The directory containing the local files to describe. Files in subdirectories are included, and their relative paths (using '/' as separator) become the path entries in the manifest. Hidden files (starting with a dot) are not included.

out

string. The path of the CSV file to write the manifest to. Typically something like inst/extdata/files.csv in your package. The file is overwritten if it exists. Comment lines describing the manifest are written to the top of the file.

url_base

string or NULL. If given, the url column is filled with paste0(url_base, path) for every file, i.e., the remote URLs are derived from the paths. If NULL (the default), the url column is left empty, and the URLs have to be derived at read time by passing base_url to read_manifest or ensure_files_available_from_manifest (or by editing the file).

Value

The generated manifest as a data.frame, invisibly.

Examples

   ## Not run: 
   manifest = write_manifest_from_dir("~/mydata", "inst/extdata/files.csv",
                                      url_base = "https://example.com/data/")
   
## End(Not run)


pkgfilecache documentation built on Sept. 1, 2026, 1:08 a.m.