is_files_current {fritools2} | R Documentation |
Check Whether Files are Current
Description
I sometimes produce a couple of files by some kind of process and need to check whether they are fairly current and probably product of the same run. So I need to know whether a bunch of files was modified within the last, say, 7 days and that their modification dates do not differ by more than, say, 24 hours.
Usage
is_files_current(
...,
newer_than = 1,
units = "week",
within = 1,
within_units = "days"
)
Arguments
... |
File paths. |
newer_than |
The number of units the files need to be newer than. |
units |
The unit of newer_than. See |
within |
The number of units the files need to be modified within. |
within_units |
The unit of within. See |
Value
TRUE
on success,
FALSE
otherwise.
See Also
Other file utilities:
clipboard_path()
,
delete_trailing_blank_lines()
,
delete_trailing_whitespace()
,
develop_test()
,
file_copy()
,
file_modified_last()
,
file_save()
,
find_files()
,
get_lines_between_tags()
,
get_mtime()
,
get_unique_string()
,
grep_file()
,
is_path()
,
paths
,
search_files()
,
split_code_file()
,
touch()
Examples
p1 <- tempfile()
p2 <- tempfile()
p3 <- tempfile()
touch(p1)
touch(p2)
Sys.sleep(3)
touch(p3)
is_files_current(p3, newer_than = 1, units = "days",
within = 4, within_units = "secs")
is_files_current(p1, p2, p3, newer_than = 1, units = "days",
within = 4, within_units = "secs")
is_files_current(p1, p2, p3, newer_than = 1, units = "days",
within = 1, within_units = "secs")
is_files_current(p1, p2, p3, newer_than = 1, units = "secs",
within = 4, within_units = "secs")