How to preserve original timestamp when copying a file?

91 views
Skip to first unread message

staceyt...@gmail.com

unread,
Jan 2, 2015, 3:48:00 PM1/2/15
to puppet...@googlegroups.com
Hi guys,

I am wondering if there was an option to preserve the original timestamp when copying a file? Right now the timestamp is updated every time the file is recopied. I don't want that.

I am using open source Puppet 3.7.3.

Thanks
Stacey

jcbollinger

unread,
Jan 5, 2015, 9:10:55 AM1/5/15
to puppet...@googlegroups.com
It depends.  Are you talking about a timestamp recorded in the file's content, or are you talking about the file's last modification timestamp (mtime) as recorded in its file metadata in the file system?

If the former, then it's a question of how you generate the content (template and/or concatenated fragments) and of how you evaluate whether it is in sync.  In that case, you haven't provided enough information for us to make any specific suggestions.

If the latter, then no, Puppet does not have any built-in mechanism providing for lying to the OS about the last access or modification time of files it manages.  If this is indeed what you are trying to do then I urge you to choose a different approach, because anything built on deliberate (meta)data falsification is going to be troublesome and brittle.


John

staceyt...@gmail.com

unread,
Jan 5, 2015, 11:33:13 AM1/5/15
to puppet...@googlegroups.com
I means the second (the file's last modification timestamp (mtime) as recorded in its file metadata in the file system).

OK, thanks anyway for the clarification.
Reply all
Reply to author
Forward
0 new messages