
Last chance! 50% off unlimited learning
Sale ends in
## S3 method for class 'default}(pathname, ...)':
touchFileundefined
- pathname
{A character
specifying the file to be updated.}
- ...
{Not used.}
Returns (invisibly) the old timestamp.
# 1. Create a file
pathname <- tempfile()
cat(file=pathname, "Hello world!")
md5a <- digest::digest(pathname, file=TRUE)
# 2. Current time stamp
ta <- file.info(pathname)$mtime
print(ta)
# 3. Update time stamp
Sys.sleep(1.2)
touchFile(pathname)
tb <- file.info(pathname)$mtime
print(tb)
# 4. Verify that the timestamp got updated
stopifnot(tb > ta)
# 5. Verify that the contents did not change
md5b <- digest::digest(pathname, file=TRUE)
stopifnot(identical(md5a, md5b))
[object Object]
file.info
().
[1] R-devel mailing list thread
Unix-like touch to update modification timestamp of file?,
started on 2008-02-26.
http://tolstoy.newcastle.edu.au/R/e4/devel/08/02/0654.html
programming
IO
file