Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? Backup and restore timestamps of files?

Dec
17
0
So I came across a script by someone which succeeds in backing up and restoring modification dates only but not creation.

pdir /(fpn"|"dy/m/d"|"th:m:s) /T:w /a:-d * >c:\flist.txt
for /f "tokens=1,2,3 delims=|" %a in (@c:\flist.txt) do touch /d%b /t%c "%a"

Is there a script in TCC LE that'll copy both the timestamps of every file in a given folder and then restore it should these timestamps ever change because a file got accidentally modified etc.?

Thanks.
 
The TOUCH command can set any one of the three timestamps (acw) of a file. To modify more than one you need to use multiple TOUCH commands.

BTW, in most circumstances the creation and access dates refer to a specific copy of a file, and the write (also known as modification) date to when content was last modified. I have thousands of files created (i.e., copied to their current location) this year, but last modified more than a decade ago.I found nearly no use for the creation date in my several decades of software development.
 
Last edited:
I'm not a software developer but I find creation dates extremely important. When I backed up all my personal stuff (much of it original) for the first few times as a young kid, I didn't realize winzip didn't preserve creation date so now I'm stuck with a lot of files that I editted multiple times over several years where I really wish I knew the exact date of origin. How old was I when I first started on this project, was it summer or winter etc. Doc files store the timestamp internally and I was really glad to see the create time, last print time etc. Brought back a lot of memories. To me losing this piece of metadata is as bad as not having the song/pic/doc at all. This is when I got into preserving mod dates (or just making file read-only) essentially treating the mod time as the creation time because the creation date would be the same for thousands of files before 2004 on the date that I copied from the ZIP backup after a disaster. I use WinRAR now but it doesn't preserve mod time of folders upon repacking because windows automatically updates the timestamp. So now I just do what an adult does and backup the entire disk image.
 
For files where creation date is relevant, such as legal documents and source code (e.g., for copyright, legal or historical reasons), I always entered it in the file body. or named the file by its creation stamp, e.g., yyyymmdd\hhmmss.*. I had worked on too many disparate systems to trust the file system to retain the information.
 

Similar threads

Replies
1
Views
1K
Back
Top