Aliyah said:
Hi,
How can I get a list of ten recent file in directories and
put it in a text file?
Can someone please provide some pointers?
Thanks in advance.
- - - - - - - - - - begin screen capture - - - - - - - - - -
<Win2000> c:\cmd>demo\Get10MostRecentFiles c:\cmd\demo\*.cmd
The ten most recent files matching 'c:\cmd\demo\*.cmd' are:
02/05/04 09:58p 369 Get10MostRecentFiles.cmd
01/31/04 08:16a 685 GetVariablesFromLastLine.cmd
01/31/04 08:07a 711 Mat.cmd
01/31/04 12:10a 75 RobStow.cmd
01/29/04 10:00p 248 NT40FullNameDir.cmd
01/27/04 10:00p 105 FindPathToFile.cmd
01/25/04 11:54p 290 DedupeFiles.cmd
01/21/04 09:48p 329 ShowShortFileName.cmd
01/20/04 10:18p 74 SpecialChars.cmd
01/14/04 06:45a 238 FiletoLowerCase.cmd
<Win2000> c:\cmd>rlist demo\Get10MostRecentFiles.cmd
=====begin c:\cmd\demo\Get10MostRecentFiles.cmd ====================
01. @echo off
02. setlocal
03. set counter=0
04. type nul > c:\temp\10MostRecentFiles.txt
05. for /f "tokens=*" %%a in (
06. 'dir /o-d %1 ^| find "/"'
07. ) do call :main %%a
08. echo/
09. echo/The ten most recent files matching '%1' are:
10. type c:\temp\10MostRecentFiles.txt
11. goto :EOF
12. :main
13. set /a counter+=1
14. if %counter% GTR 10 goto :EOF
15. echo %*>>c:\temp\10MostRecentFiles.txt
16. goto :EOF
=====end c:\cmd\demo\Get10MostRecentFiles.cmd ====================
- - - - - - - - - - end screen capture - - - - - - - - - -