1.

Solve : Echo Message Based on most recent file extension?

Answer»

I need to do a sort of a directory based on time/extension.  If the most recent FILE extension is XXX then I want to display a message.  If the most recent file extension is YYY then I was to display a different message.  Using Windows XP.

Example -

File1.XXX - 12/17/2010 11:00 am
File2.YYY - 12/15/2010  12:15 pm

Message - "XXX is the most recent file extension.

Any ideas would be APPRECIATED.  Thanks! CODE: [Select]echo off
for /f "delims=" %%A in ('dir /b /od /a-d ^| find /v "%~nx0"') do set lastext=%%~xA
if /i "%lastext%"==".XXX" goto xxx
if /i "%lastext%"==".YYY" goto yyy
goto neither
:xxx
echo last file had extension xxx
goto END
:yyy
echo Last file had extension yyy
goto end
:neither
echo Last file had neither xxx nor yyy extension
:end
echo Finished


That answer was awesome, fast, AND it worked!!  Thank you very much.  Without getting too mushy, it's people like you that make the internet cool  .  Thanks again.



Discussion

No Comment Found