Any files or directories in dir_to_clean
are moved to the new directory
dir_to_clean/old/moved_%Y%m%d_%H%M%S
UNLESS THERE ARE MORE THAN max_files
IN WHICH CASE ALL ARE DELETED
clean_dir(dir_to_clean, skip = "old", max_files = 10000)
Path to directory to 'clean'
Character. Any strings that identify files to skip (identified
via base::grep()
)
Numeric. If there are more than max_files
to be moved,
files will be DELTETED instead of moved.
Returns NULL
. Any files in dir_to_clean
are moved (or deleted).
Log written to dirname(dir_to_clean)