Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"for" loop over files sorted by last modified date?

0 views
Skip to first unread message

Sebastian Kaist

unread,
Jun 25, 2009, 6:45:14 AM6/25/09
to
My current for loop looks simplified to

for /F "tokens=2,3 " %%A in ('findstr /n /I foobar *.txt^|findstr :1:') DO
@echo %%A %%B >>"%tempfile%"

As you can see all *.txt files are investigated. How can I force MSDOS to read
these *.txt files sorted by last modified date of the file in ascending (or descending) order?
By default they are read in alphabetical order (I think).

Furthermore is there a way to retrieve inside the above for loop the last update date
of the original file?

I have read that this should work with a meta-variable like %%~ti
But how do I refer to the underlying file instead of the retrieved token?

Thank you for your help
Sebastian

0 new messages