SPUG: stat command in NT

ced at carios2.ca.boeing.com ced at carios2.ca.boeing.com
Tue Oct 3 17:11:38 CDT 2000


> How does one go about getting the timestamp on files in the NT world? I've
> written a quick script almost straight out of the Cook Book that works
> great on Unix but not at all on NT (except on . and ..). Take a look:

> use Time::Local;

> opendir (DIR, $somedir) or die "can't open $somedir: $!";

>     ($access, $modify, $create) = (stat($sourcefile))[8..10];
>     print "$sourcefile : ";
>     print "$access : $modify : $create\n";
> }
.closedir(DIR);


Normally, you need the directory pre-pended unless the program
itself also runs in the same directory. 

   opendir (DIR, $somedir) or die "can't open $somedir: $!";
   while (defined($sourcefile = readdir(DIR))) {
       ($access, $modify, $create) = (stat("$somedir/$sourcefile"))[8..10];
                                


Perhaps you were in the right place at the right time when
you ran on Unix :)


Rgds,
--
Charles DeRykus

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list