-1

I am trying to find the latest log file from the log directory in windows which has sub folders based on date

I have to make a search of 1000+ keywords in a text file and find the match using the file name in keyword and output the path to a notepad

Example:

The source text file has many rows like 

Apple
Mango
Orange 

Then we have to find the matching file like

 FF_Apple_201502.txt ( Latest one among the results )

Any help would be appreciated

user2834105
  • 67
  • 1
  • 1
  • 9

1 Answers1

0

You can try using the below to find the latest file:

@echo off
for /f "delims=" %%x in ('dir /od /a-d /b *.*') do set recent=%%x
echo %recent%

then when you have the file you can pipe it into find:

FIND [/V] [/C] [/N] [/I] "string" [pathname(s)]

You can find the switch commands here: ss64.com/nt/find.html