Windows timestamps

Quoting myself from Re: Change create file date:

A quick search on CPAN reveals that Win32API::File::Time may be able to help you. From its synopsis:

use Win32API::File::Time qw{:win}; ($atime, $mtime, $ctime) = GetFileTime ($filename); SetFileTime ($filename, $atime, $mtime, $ctime);

(Unfortunately still untested.)

Update:

the timestamps, at the moment, are one of the key ways that I’m keeping track of the large amount of data I’ve got

Actually, as you're discovering yourself, this is dangerous, I'd strongly recommend you don't rely on the filesystem to keep track of that information, at the very least store the date/time information in a separate simple text file. Update 2: The following will take the list of files in the current directory (excluding those beginning with a dot) and output a tab-separated list of filename, ctime, mtime, and atime (if available). You can change the glob expression "*" to match specific files if you like.

perl -MFile::Glob=bsd_glob -le '$,=qq(\t);print$_,(stat)[10,9,8]for bs +d_glob(q(*))'

(You may need to change the quotes, I'm not on Windows at the moment.)


In reply to Re: Maintaining date modified timestamp when copying files (updated x2) by haukex
in thread Maintaining date modified timestamp when copying files by Maire

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.