I needed a list of files from a folder with only filesize. The first choice of commands was the DIR command, however, there is no command line switch or combination that will allow for this type of output. I didn’t want to have to install any third party application or Microsoft extras to get the desired result. Since, I am not the first to be faced with this situation, a quick Internet search found the command line.
forfiles /p C:\Temp /m file1.txt /c "cmd /c echo @fsize"
With the above code, I reworked the command to scan multiple files and output to a file like this.
forfiles /p D:\txts /m *.txt /c "cmd /c echo @fsize @fname" > D:\logfile.txt
Actually, there is a useful DIR command that does exist. [Updated 1/31/2012]
dir | findstr "File(s) Dir(s)"