Batch file to list file sizes

December 17, 2008 at 14:07:21
Specs: Win XP, Intel, 2 Gig
Hi,

I'm looking to list all file names (including
hidden) in a directory that are greater than
X amount of meg in size (plus list the size),
and also to list any files in sub directories
that meet the same criteria. Have looked
through the forum but can only find examples
of when looking at just an individual file,
not directory contents.

TIA

Lithium


See More: Batch file to list file sizes

Report •


#1
December 17, 2008 at 14:22:13
for /f "tokens=* delims= " %%a in ('FOLDER\*') do (
if %%~Za gtr SIZE echo %%a is bigger than SIZE
)

I only Batch if possible, 2000 more lines of code, oh well.


Report •

#2
December 17, 2008 at 14:48:02
Dude,

Cheers for the speedy reply but I replaced
FOLDER with Stuff (the folder name) and get :

'Stuff\*' is not recognized as a operable
program or batch file.

Am I being thick, sorry DOS not my thing! =)


Report •

#3
December 17, 2008 at 14:53:27
OoOps, lol. I am so used to text parsing I put in the /f "...." by mistake :)

Heres a working, TESTED, version.

@echo off
for %%a in ("FOLDER\*") do (
if %%~Za gtr SIZE echo %%a is %%~Za
)

I only Batch if possible, 2000 more lines of code, oh well.


Report •

Related Solutions

#4
December 17, 2008 at 15:20:14
Sweet =), so my next question is; could it
also then list files within Sub-directories
of FOLDER\ as well? Wot you thought u had
betta things to do ;) lol

Report •

#5
December 18, 2008 at 01:49:54
@echo off & setLocal EnableDelayedExpansion

pushd c:\files

for /f "tokens=* delims= " %%a in ('dir/b/s') do (
if %%~Za gtr 30000 echo %%a is %%~Za
)

for /f "tokens=* delims= " %%a in ('dir/b/s/ah') do (
if %%~Za gtr 30000 echo %%a is %%~Za
)


=====================================
If at first you don't succeed, you're about average.

M2


Report •


Ask Question