View source: R/resmush_clean_dir.R
| resmush_clean_dir | R Documentation |
Use with caution. Remove files that match suffix from one or more
directories. This is intended to clean output files created by
resmush_file() or resmush_dir().
resmush_clean_dir(dir, suffix = "_resmush", recursive = FALSE)
dir |
A character vector of directory paths. See the |
suffix |
A character string containing the suffix pattern used to
identify files. The value is interpreted as a regular expression. The
default is |
recursive |
Logical. Should the file search recurse into directories? |
An invisible() NULL. Messages list the files selected for removal.
resmush_file() and resmush_dir() create the suffixed output
files that this function removes.
# Create a temporary file with a suffix to remove.
png_file <- system.file("extimg/example.png", package = "resmush")
suffix <- "_would_be_removed"
tmp_png <- file.path(
tempdir(),
paste0("example", suffix, ".png")
)
file.exists(tmp_png)
file.copy(png_file, tmp_png, overwrite = TRUE)
file.exists(tmp_png)
# Run with the default suffix. This should not remove the file.
resmush_clean_dir(tempdir())
file.exists(tmp_png)
# Use the matching suffix to remove the file.
resmush_clean_dir(tempdir(), suffix = suffix)
file.exists(tmp_png)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.