lo monks I have this script for reading a csv like so: c:\thisdir\thatone\somedoc.xls , 102324455 (unix date stamp) and taking those values and setting the last changed date on the file in question. I am using utime and it works IF i own the file (even though I have rights to the files). I understand this is a limitation of utime so fair enuff. Is there another tool/method of setting files back to their original time? here's my script (excuse my poor perl I am no monk yet).
use Win32::OLE; use File::stat; open(CSV, "c:/temp/doctime.txt"); #csv of filename , date @title = <CSV>; for ($i = 0; $i < scalar(@title); $i++) { ($file1[$i], $date[$i] $blank[$i]) = split(",", $title[$i]); } for ($a = 0; $a < scalar(@file1); $a++) { $access=$date[$a]; $filez = $file1[$a]; print "File name # $filez\n"; print "Previous date # $access\n"; utime $access, $access, $filez || die print "couldn not set utime for +$filez\n"; }
This works great loyally skipping any file not owned by me (which I don't want it to). I am running it from Win2k and the files are on Unix/Samba but the same thing happens locally. Any advice ideas would be great.

In reply to setting time stamps on files by ironpaw

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.