View source: R/resmush_clean_dir.R
resmush_clean_dir | R Documentation |
Use with caution. This would remove files from your computer.
Clean a directory (or a list of directories) of files created by
resmush_file()
.
resmush_clean_dir(dir, suffix = "_resmush", recursive = FALSE)
dir |
A character vector of full path names. See |
suffix |
Character, defaults to |
recursive |
Logical. Should the files to be deleted recurse into directories? |
Nothing. Produce messages with information of the process.
resmush_file()
, resmush_dir()
, list.files()
, unlink()
# Simple example
png_file <- system.file("extimg/example.png", package = "resmush")
# Copy to a temporary file with a given suffix
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)
# This won't remove it
resmush_clean_dir(tempdir())
file.exists(tmp_png)
# Need suffix
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.