Thanks Chris..

So far everyone has jumped on using dos command... And at some cost. To
answer your question.. Yes I need to find the time/date on the "newest"
file in the dir.... But this is not tooo difficult once I know which
file IS the newest!! I have many directories of hundreds of files.... I
ultimately want to display to my user that a particular directory has
new files  as of "today" or "yesterday"... All possible if I could
easily test and determine which file in a particular directory is the
"newest".

I assume there is no simple way to do this.. In perl?? My webserver is
running on Win xp and I am running Perl 5.8.6


TIA
Chuck 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Chris Wagner
Sent: Monday, June 20, 2005 7:45 PM
To: Perl-Win32-Users Mailing List
Subject: Re: Find the date of the newest file????


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

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

Reply via email to