[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



use strict ;
use POSIX ;
use File::Copy ;
use File::Basename ;
use File::stat ;


chdir "/vm1/share/users/cl"
   or die "BZZZT $!\n" ;

for my $file (<*.EMB>)
  { my ($name,$path,$suffix) = fileparse($file,"\.EMB") ;
    my $mod = (stat $file)[9];
    my $datestamp = strftime("-%Y%m%d-%H%M%S",localtime($mod)) ;
    copy $file,"/vm1/share/users/cl/$name$datestamp$suffix"
      or warn "Cannot copy $file $!\n" ;
  }
--------------------------

Perl gurus,

I am having trouble with the admittedly ugly script above. I am attempting
to append the date modified to all files in a particular directory. All goes
well, except my date modified is getting screwed up (during formatting I
suspect). I end up with the start of the Unix epoch as opposed to the mod
date. Does someone have a more elegant script that I can use or a pointer on
how to fix this one?

Thanks

--
Jonathan 


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00979" href="msg00979.html">[ale] Quick Perl Q</a></strong>
<ul><li><em>From:</em> esoteric at 3times25.net (Geoffrey)</li></ul></li>
<li><strong><a name="00980" href="msg00980.html">[ale] Quick Perl Q</a></strong>
<ul><li><em>From:</em> esoteric at 3times25.net (Geoffrey)</li></ul></li>
<li><strong><a name="00981" href="msg00981.html">[ale] Quick Perl Q</a></strong>
<ul><li><em>From:</em> esoteric at 3times25.net (Geoffrey)</li></ul></li>
<li><strong><a name="00983" href="msg00983.html">[ale] Quick Perl Q</a></strong>
<ul><li><em>From:</em> fletch at phydeaux.org (Fletch)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00976.html">[ale] CUPS + efax + fax4CUPS as a fax server for Win32 clients</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00978.html">[ale] Cheap UPS TOMORROW http://slickdeals.net/#p5461 APC Conext	900VA $30 after $40 rebate</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00976.html">[ale] CUPS + efax + fax4CUPS as a fax server for Win32 clients</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00979.html">[ale] Quick Perl Q</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00977"><strong>Date</strong></a></li>
<li><a href="threads.html#00977"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>