all_files_new {campfin}R 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)

[Package campfin version 1.0.9 Index]