all_files_new: Check if all files in a directory are new

View source: R/files-new.R

all_files_newR Documentation

Check if all files in a directory are new

Description

Tests whether all the files in a given directory have a modification date equal to the system date. Useful when repeatedly running code with a lengthy download stage. Many state databases are updated daily, so new data can be helpful but not always necessary. Set this function in an if statement.

Usage

all_files_new(path, glob = NULL, ...)

Arguments

path

The path to a directory to check.

glob

A pattern to search for files (e.g., "*.csv").

...

Additional arguments passed to fs::dir_ls().

Value

logical; Whether all() files in the directory have a modification date equal to today.

Examples

tmp <- tempdir()
file.create(tempfile(pattern = as.character(1:5)))
all_files_new(tmp)

campfin documentation built on Oct. 20, 2023, 5:06 p.m.