Function to check file create time and according the requirement to return check value

get_files_ctime(input_files = NULL, files_dir = NULL, pattern = ".*.txt",
  return_ctime = TRUE, return_check = TRUE,
  check_time_fun = function(files_ctime) {     all(files_ctime ==
  files_ctime[1]) })

Arguments

input_files

Basename of files that need to be check, default is NULL and use the regular expression pattern to select files

files_dir

Directory name of input files

pattern

Use regular expression to select files in files_dir

return_ctime

Logical indicating wheather to return files modification times

return_check

Logical indicating wheather to return file times check status

check_time_fun

Function to check files time, default is all equal

Examples

file_a <- tempfile() file_b <- tempfile() file.create(c(file_a, file_b))
#> [1] TRUE TRUE
get_files_ctime(input_files = c(file_a, file_b), return_ctime = TRUE)
#> $files_ctime #> [1] "2018-05-06 16:28:02 CST" "2018-05-06 16:28:02 CST" #> #> $status #> [1] FALSE #>