Learn R Programming

mark (version 0.8.2)

add_file_timestamp: Add file timestamp

Description

Adds a timestamp to a file

Usage

add_file_timestamp(
  x,
  ts = Sys.time(),
  format = "%Y-%m-%d %H%M%S",
  sep = " "
)

Value

The full name paths with the appended time stamp

Arguments

x

A vector of files

ts

A single timestamp or vector of timestamps (default: Sys.time())

format

A format to be applied to the times; set to NULL to skip formatting

sep

A character vector of length 1 to separate the timestamp from the file name

Examples

Run this code
file1 <- tempfile(fileext = ".txt")
file2 <- tempfile()

add_file_timestamp(file1)
add_file_timestamp(file2)

file.remove(file1, file2)

Run the code above in your browser using DataLab