Dir is a shell builtin in Windows so u need to invoke a shell first.

perl
$a = (`command.com /c dir /o-d /a-d /b`)[0];
print $a;

Or if u have Cygwin installed it's this:
perl
$a = (`ls -1t`)[0];
print $a;

But looking at ur original email, did u want the newest file or the
time/date *of* the newest file?

perl
$a = substr( ( `command.com /c dir /o-d /a-d` )[5], 29, 15);
print $a;

Of course verify that for your version of Windows.


At 12:33 PM 6/20/05 -0700, Jezebel wrote:
>--- Charles Maier wrote:
>
>> I have a Perl app that catalogs photo files. IS
>> there a quicker way of
>> finding "the newest" file date in a directory other
>> than doing a stat on
>> each file in it??  How??
>> 
>
>"dir /o-d /a-d" lists files in the directory by
>reverse date. send the results of this command to a
>variable or a file. the topmost (first) entry will be
>your newest file.






--
REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 >=--
"...ne cede males"

00000100

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to