miyahira
asked on
List files and their sizes in subfolders
Hello,
Is there any easy way to list all files (and their sizes) that are contained in sub folders.
Run something like:
D:\MainFolder\list_files_a nd_size.ba t
And get a list of all files and their sizes in all subfolders of MainFolder?
Thank you
Is there any easy way to list all files (and their sizes) that are contained in sub folders.
Run something like:
D:\MainFolder\list_files_a
And get a list of all files and their sizes in all subfolders of MainFolder?
Thank you
dir /s This command displays files in specified directory and all subdirectories.
ASKER
Yea, but I only want to display SubFolder, FileName and size. No more.
Here's a fairly simple BAT file that will write to a CSV file with the file size and full path. Then just open the CSV file in Excel to allow reporting, sorting, etc. Naturally the output format could be changed if this isn't ideal...
@echo off
set BaseDir=D:\MainFolder
set OutFile=logfile.csv
(
echo Size,Filename
for /f "tokens=*" %%F in ('dir /s /b /a-d "%BaseDir%"') do echo %%~zI,"%%~I"
)> "%OutFile%"
~bp
ASKER
Hi billprew,
Unfortunately, command:
only lists path and file name, as shown in image attached.
It doesn't show size of files.
DirSize.png
Unfortunately, command:
dir /s /b /a-d "%BaseDir%
only lists path and file name, as shown in image attached.
It doesn't show size of files.
DirSize.png
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks paultomasi, you're the Best!
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Thank you