In order to ease the manual copying of large file amounts, I often use FreeFileSync. I noticed that it preserves the original file information such as when a file was created, last modified etc.
Now I need to regularly copy tons of files in batch mode and I'd like to do it in R. So I wondered if R is capable of preserving that information as well. AFAIU, file.rename()
and file.copy()
alter the file information, e.g. the times are set to the time the files were actually copied.
Is there any way I can restore the original file information after the files have been copied?
rsync -a
,cp -a
, or eventar
(there aretar
anduntar
commands in R, so it may work on Windows as well). – Fimbriatersync
on Windows (which comes with Rtools, for instance) doesn't seem to support the "extended attributes"-X
option which preserves file creation times on other OS's. The closest thing I see is to usezip()
and thenunzip(..., setTimes=TRUE)
. It's not a perfect substitute though. It seems to change some times by 1 second for some reason, and requires more attention to the current working directory, destination directory, etc. – Archiepiscopatersync
on Windows! – Helmsfile.rename()
does preserve date modified and date created (at least for me on Win7 64 bit). I usefile.rename()
instead offile.copy()
for that reason. But obviously you can't use it copy just rename or move. – Edgardo