Does anyone know how I can change the mtime of a folder from within perl on win32? I'd really prefer to not have to use an external binary (I have lots of files to process), and utime doesn't work on folders (with or without -U) but files are fine.

The platform supports it:

G:\>mkdir foo

G:\>stat foo
  File: `foo'
  Size: 0               Blocks: 0          IO Block: 1024   directory
Device: 435c336ch/1130115948d   Inode: 12243914462851298397  Links: 2
Access: (0755/drwxr-xr-x)  Uid: (  400/ jpierce)   Gid: (  401/mkpasswd)
Access: 2007-02-05 00:00:00.000000000 -0500
Modify: 2007-02-05 05:29:16.000000000 -0500
Change: 2007-02-05 05:29:16.000000000 -0500

G:\>touch --date "July 14, 2000" foo

G:\>stat foo
  File: `foo'
  Size: 0               Blocks: 0          IO Block: 1024   directory
Device: 435c336ch/1130115948d   Inode: 12243914462851298397  Links: 2
Access: (0755/drwxr-xr-x)  Uid: (  400/ jpierce)   Gid: (  401/mkpasswd)
Access: 2000-07-13 01:00:00.000000000 -0400
Modify: 2000-07-14 00:00:00.000000000 -0400
Change: 2000-07-14 00:00:00.000000000 -0400
But no joy:
G:\>perl -e "utime(undef, 1156817846, 'foo') #Mon Aug 28 22:17:26 2006"

G:\>stat foo
  File: `foo'
  Size: 0               Blocks: 0          IO Block: 1024   directory
Device: 435c336ch/1130115948d   Inode: 12243914462851298397  Links: 2
Access: (0755/drwxr-xr-x)  Uid: (  400/ jpierce)   Gid: (  401/mkpasswd)
Access: 2007-02-05 00:00:00.000000000 -0500
Modify: 2000-07-14 00:00:00.000000000 -0400
Change: 2000-07-14 00:00:00.000000000 -0400
This appears to be Siemens perl 5.8.0.

--
In Bob We Trust, All Others Bring Data.


In reply to utime of dirs on win32 by belg4mit

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.