Use with caution. This removes files from your computer. Clean one or
more directories of files created by resmush_file().
Arguments
- dir
A character vector of full path names. See the
pathargument inlist.files().- suffix
Character. Defaults to
"_resmush". Seeresmush_file().- recursive
Logical. Should the file search recurse into directories?
Value
Returns an invisible() NULL value and produces messages summarizing the
process.
Examples
# \donttest{
# 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)
#> [1] FALSE
file.copy(png_file, tmp_png, overwrite = TRUE)
#> [1] TRUE
file.exists(tmp_png)
#> [1] TRUE
# Run with the default suffix. This should not remove the file.
resmush_clean_dir(tempdir())
#> ℹ No files to clean in /tmp/Rtmpae8Dwc with suffix "_resmush".
file.exists(tmp_png)
#> [1] TRUE
# Use the matching suffix to remove the file.
resmush_clean_dir(tempdir(), suffix = suffix)
#> ℹ Removing 1 file:
#> → /tmp/Rtmpae8Dwc/example_would_be_removed.png
file.exists(tmp_png)
#> [1] FALSE
# }
