Computing.Net > Forums > Programming > Extract from newest .log file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Extract from newest .log file

Reply to Message Icon

Name: dksilvia
Date: July 22, 2009 at 07:41:42 Pacific
OS: Windows XP
Product: Microsoft WINDOWS XP
Subcategory: Batch
Comment:

I'm trying to extract some information from a .log file. But there are new log files each time this certain software opens. So I'm trying to find a way to just get some of the information from that newest .log file stored in a log folder. They're named "server-2009-07-22.log" for example, but there could be multiple each day, just adding a _2 or _3 etc. at the end... Any ideas? I've learned a lot from this website, so I decided to start here.



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: July 22, 2009 at 09:44:20 Pacific
Reply:

@echo off & setLocal EnableDELAYedExpansion

for /f "tokens=* delims= " %%a in ('dir/b/o-d') do (
set newest=%%a
goto :got it
)
:got it
echo newest is !newest!


=====================================
If at first you don't succeed, you're about average.

M2


0
Reply to Message Icon

Related Posts

See More


equation of parabola in c... C++ iterate over a consta...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Extract from newest .log file

Read last line from newest file in folder www.computing.net/answers/programming/read-last-line-from-newest-file-in-folder/19280.html

read log file www.computing.net/answers/programming/read-log-file/17851.html

append log file to secondary log file www.computing.net/answers/programming/append-log-file-to-secondary-log-file/19653.html