Solved How to make only the file size of all files appear in a txt

April 16, 2014 at 20:04:20
Specs: Windows 7
Hello, the command below would allow me to set the file size of every file I want as a variable

FOR /F "usebackq" %%A IN ('%vare1%') DO set svare1=%%~zA

But because I have 1000s of files, using the above command for each file would take an hour, yet typing dir/w >p.txt would output all the 1000s of filenames and its sizes in a few seconds.
So what I was wondering was if there's a way to eliminate everything in p.txt except the filesizes so that I could set them as variables afterwards.
Thank you.


See More: How to make only the file size of all files appear in a txt

Report •

#1
April 17, 2014 at 03:03:10
YES, there is a straightforward way to achieve what you need, but, until you miss to give a feedback to people that offered help, no more solutions will be posted (almost by me).

Report •

#2
April 17, 2014 at 10:38:01
✔ Best Answer

for %%i in (*) do (echo.%%i=%%~zi) >> list.txt

then to extract the filesizes

for /F "tokens=1,2 delims==" %%i in (list.txt) do set %%i=%%j

If you just want the list of filesizes

for %%i in (*) do (echo.%%~zi) >> list.txt

message edited by IVO


Report •
Related Solutions


Ask Question