# Solved: File size command



## angelr82 (Jun 15, 2010)

So I am trying to figure out how to get a file list of a directory and the subdirectories , file size or vise versa. I tried DIR /S which gives me a directory listing with date/time, filesize and file name. I just need "C:\mydoc.txt","2,000" output to a text file. Any suggestions?


----------



## foxidrive (Oct 20, 2012)

The filesizes are pure numbers:


```
@echo off
for /f "delims=" %%a in (' dir /b /s /a-d ') do >>"f:\filelist.txt" echo "%%a","%%~za"
```


----------



## angelr82 (Jun 15, 2010)

foxidrive said:


> The filesizes are pure numbers:
> 
> 
> ```
> ...


Good gosh that worked perfect!!!! Thank you! Where can I go to brush up on all that? I never would have figured that out with normal /? in CMD


----------



## foxidrive (Oct 20, 2012)

for /?
gives the metavariables on the last page, plus a lot of other help.


----------

