ms dos - How to get the Last Modified date of all files in a folder using Batch -
suppose have folder contains 5 files. want run batch script outputs filenames in folder along last modified dates. output has written text file.
the output should follows:
- sample1.xls 4/7/2011
- sample2.xls 3/6/2011
- sample3.xls 5/4/2011
- sample4.xls 2/4/2011
- sample5.xls 6/2/2011
from commandline:
for /f %a in ('dir /b') @echo %a %~ta this outputs:
d:\temp\modtime>dir volume in drive d data1 volume serial number 925b-dc37 directory of d:\temp\modtime 06/28/2012 05:03 pm <dir> . 06/28/2012 05:03 pm <dir> .. 06/28/2012 05:02 pm 2 a.txt 06/28/2012 05:03 pm 2 b.txt 2 file(s) 4 bytes 2 dir(s) 1,485,646,065,664 bytes free d:\temp\modtime>for /f %a in ('dir /b') @echo %a %~ta a.txt 06/28/2012 05:02 pm b.txt 06/28/2012 05:03 pm make % %% put in batch file. if don't need times, can post-process rid of them.
Comments
Post a Comment