bb_cleanup: Postprocessing: remove unwanted files

View source: R/postprocess.R

bb_cleanupR Documentation

Postprocessing: remove unwanted files

Description

A function for removing unwanted files after downloading. This function is not intended to be called directly, but rather is specified as a postprocess option in bb_source.

Usage

bb_cleanup(
  pattern,
  recursive = FALSE,
  ignore_case = FALSE,
  all_files = FALSE,
  ...
)

Arguments

pattern

string: regular expression, passed to file.info

recursive

logical: should the cleanup recurse into subdirectories?

ignore_case

logical: should pattern matching be case-insensitive?

all_files

logical: should the cleanup include hidden files?

...

: extra parameters passed automatically by bb_sync

Details

This function can be used to remove unwanted files after a data source has been synchronized. The pattern specifies a regular expression that is passed to file.info to find matching files, which are then deleted. Note that only files in the data source's own directory (i.e. its subdirectory of the local_file_root specified in bb_config) are subject to deletion. But, beware! Some data sources may share directories, which can lead to unexpected file deletion. Be as specific as you can with the pattern parameter.

Value

a list, with components status (TRUE on success) and deleted_files (character vector of paths of files that were deleted)

See Also

bb_source, bb_config, bb_decompress

Examples

## Not run: 
  ## remove .asc files after synchronization
  my_source <- bb_source(..., postprocess = list(list("bb_cleanup", pattern = "\\.asc$")))

## End(Not run)


AustralianAntarcticDivision/bowerbird documentation built on March 8, 2024, 8:33 a.m.