I realise some of my perl was not as technically correct as it could have been. With some help from this thread though all is now working. Several issues lead to this 1> utime in windows will only change dates to files you own (even if you have write access). This is the same in unix but given root owns everything root will do them all. Unix does not like spaces, fair enough put "" around the word. This does not work with utime if you use it like this:
$oldtime = 1043205456; $filename = /share/shared/path/somepath/doc with space.doc; utime ($oldtime, $oldtime, "$filename");
but it will work like this
chdir("/share/shared/path/somepath"); $filename = doc with space.doc; utime ($oldtime, $oldtime, "$filename");
So finally this is the perl for setting a bunch of docs with spaces as root in unix.
#!/usr/bin/perl -w open(CSV, "/tmp/doctime.txt"); #contains comma seperated path,filename +,olddate @title = <CSV>; # I know this is lame but it works and I understand it for ($i = 0; $i < scalar(@title); $i++) { # some of you dont like this but it works fine ($dironly[$i], $filename[$i], $date[$i]) = split(",", $title[$i]); + } for ($a = 0; $a < scalar(@filename); $a++) { $access= $date[$a]; $file = $filename[$a]; $dir = $dironly[$a]; chdir("$dir"); print "$dir $file $access\n"; #use this for a log print utime ($access, $access, "$file"), "\n"; }
this is a snippet from the file it reads the values from
/staff/cy/share/shard/cr,MS_CR_New diensions server.xls,1020001208 /staff/cy/share/shard/cr,MS_CR_keon route modification 180902.xls,1044 +234302 /staff/cy/share/shard/cr,MS_CR Key route addition001.xls,1044234302 /staff/cy/share/shard/cr,CY_CR_Memory upgrade.doc,1034234102
Results mean more than tidy code <G> (still tidy code would be nice). Three scripts, one to record all dates, one to change the document properties of office docs, one to set the dates back (as the second script makes all file dates the present).

In reply to Re: spaces in filenames by ironpaw
in thread spaces in filenames 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.