Jorge
Jorge

Reputation: 175

List only path, file name and size in Windows command prompt

In Windows command prompt, I'm trying to list only path, file name and size, of all files including in a folder and its sub folders. Like:

dir /s /b /a-d "C:\MainFolder\"

Problem is that I don't know how to show size of file. Is it possible?

Upvotes: 3

Views: 26297

Answers (2)

Bal mukund kumar
Bal mukund kumar

Reputation: 363

Try this command ---

for %%a in (*) do echo %%a

Upvotes: 1

dbenham
dbenham

Reputation: 130819

From the command line:

for %F in ("c:\MainFolder\*") do @echo %~zF  %F

Double up the percents if you use the command in a batch file.

Type HELP FOR or FOR /? from the command prompt for more information on the various values that are available with FOR variable expansion.

Upvotes: 5

Related Questions