Computing.Net > Forums > Programming > Batch file to find newest files

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.

Batch file to find newest files

Reply to Message Icon

Name: ikerstges
Date: August 8, 2008 at 05:27:11 Pacific
OS: Windows XP Professional
CPU/Ram: Core2 Duo/1024 Mb
Product: HP
Comment:

Hi All,

I'm monitoring log files of testcases. I have a batchfile for processing these logfiles and in this batchfile, I have implemented to dump all filenames to a testfile: "dirlist.txt".

I'm trying to implement a solution where the batchfile will only process the files that are NOT in the "dirlist.txt".

I have tried to find someting like following:

for /f "tokens=* delims= " %%a in ('dir/b "C:\Scripts\Mercury\Logs\TE_*.log"') do (
if %%a not in ("C:\Scripts\Mercury\dirlist.txt") (
commands....
)

I have tried using various 'find' statements, but I cannot get it solved.

Agan, any help will be greatly appreciated!


Thanks in advance!
Igor



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: August 8, 2008 at 08:34:31 Pacific
Reply:

for /f "tokens=* delims= " %%a in ('dir/b "C:\Scripts\Mercury\Logs\TE_*.log"') do (
find "%%a" < C:\Scripts\Mercury\dirlist.txt > nul
if errorlevel 1 echo commands....
)


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

M2


0

Response Number 2
Name: ghostdog
Date: August 8, 2008 at 18:35:02 Pacific
Reply:

not really sure what you are doing, but findstr can take in wildcards as filenames.


findstr /M "test" *.txt

the above command finds all text files that have "test" in them. Check findstr /? for more info. Also, the /D option might be interesting for you.

0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







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: Batch file to find newest files

ftp batch to download newest files www.computing.net/answers/programming/ftp-batch-to-download-newest-files/17252.html

Batch to find / delete files except one? www.computing.net/answers/programming/batch-to-find-delete-files-except-one/19891.html

Batch File To Find The String Count www.computing.net/answers/programming/batch-file-to-find-the-string-count/20226.html