e_file_first_last: List of filenames as the first or last n by filename or file...

View source: R/e_file_first_last.R

e_file_first_lastR Documentation

List of filenames as the first or last n by filename or file time matching a regular expression within a path

Description

List of filenames as the first or last n by filename or file time matching a regular expression within a path

Usage

e_file_first_last(
  name = NULL,
  path = ".",
  sw_first_last = c("first", "last")[2],
  n_file = 1,
  sw_sort = c("filename", "mtime", "ctime", "atime")[1],
  sw_rev_order = c(TRUE, FALSE)[1],
  ...
)

Arguments

name

filename regular expression for which to search

path

path

sw_first_last

first (oldest) or last (newest) set of files

n_file

number of filenames to return

sw_sort

sort by filename, or by time from file.inf, file modification, last status change, or last access time

sw_rev_order

default sort starting with first (oldest) or reverse to start with last (newest)?

...

additional arguments passed to list.files in addition to path and pattern

Value

fn_out filename list with path

Examples

## Not run: 

# last filename by name in getwd()
e_file_first_last()
# newest 3 files in getwd()
e_file_first_last(n_file = 3, sw_sort = "mtime")


## End(Not run)

erikerhardt/erikmisc documentation built on April 17, 2025, 10:48 a.m.