archive: Archives files from a folder based on modification date. All...

View source: R/archive.R

archiveR Documentation

Archives files from a folder based on modification date. All files within folder are processed based on modification date.

Description

Archives files from a folder based on modification date. All files within folder are processed based on modification date.

Usage

archive(
  from,
  to = "Archive",
  date = Sys.Date(),
  dir = FALSE,
  string = "",
  exclude = NA,
  keep = FALSE
)

Arguments

from

Path to folder containing files to archive.

to

Folder name to archive files to. Default is Archive

date

File modification date from which files are to be retained. Files prior to this date are archived. Default is Sys.Date().

dir

Optional logical argument; also archive folders or not. Default is FALSE.

string

Optional string pattern in files to archive.

exclude

Optional string pattern of files to exclude from archiving

keep

Optional retain archived files in original location and copy to archive folder. Default is FALSE.

Value

Moves older files based on date to an archive subfolder

Author(s)

Diane Hatziioanou

Examples


# Move all files excluding folders to an Archive subfolder
# archive("C:..../analysis")

# Move all files excluding folders to a different folder
# archive(from = "C:..../analysis", to = "C:.../backup/outputs")

## Copy all files and folders with the "output_version_x" in the file name
## which have not been modified in the past week to a different folder
# archive(from = "C:..../analysis", to = "C:.../backup/outputs", date = Sys.Date() -7,
#         string = "output_version_x", keep = T, dir = T)



DHatziioanou/simpleepi documentation built on Sept. 24, 2024, 5:25 a.m.