|
Answer» Can someone let me know how can we get the folder name and size using MS DOS.?Do you MEAN real MS-DOS or Windows command?Anything would do. Either MS Dos or Windows..Code: [Select]@ECHO off for /f "tokens=3,4 skip=3" %%A in ('dir /a:-d') do (echo %%A %%B) The last two lines are the total of all the files, and the bytes free respectively.
FBim sure there is a SIMPLER way to do this, like u can just go into command prompt and type dir and the file name and it shud come up with the files and folders and there sizesok 'master'.... post some code which displays only size and name which is simpler than my code.
FBIf you have some folders in C:\test\, list the folder name and size:
Code: [Select]@echo off for /d %%a in (C:\test\*) do ( set /p=%%a <nul for /f "tokens=3-4" %%h in ('dir "%%a"^|find "File(s)"') do ( echo %%h %%i ) )the following will recursively list directory names and sizes:
dir/s|findstr "bytes$ Directory"SYSINTERNALS du utility very useful
http://technet.microsoft.com/en-us/sysinternals/bb896651.aspx
|