Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Batch file to list file sizes
Name: Lithium2008 Date: December 17, 2008 at 14:07:21 Pacific OS: Win XP CPU/Ram: Intel, 2 Gig Product: Microsoft XP
Comment:
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.
Name: BatchFreak Date: December 17, 2008 at 14:22:13 Pacific
Reply:
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.
0
Response Number 2
Name: Lithium2008 Date: December 17, 2008 at 14:48:02 Pacific
Reply:
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! =)
0
Response Number 3
Name: BatchFreak Date: December 17, 2008 at 14:53:27 Pacific
Reply:
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.
0
Response Number 4
Name: Lithium2008 Date: December 17, 2008 at 15:20:14 Pacific
Reply:
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
0
Response Number 5
Name: Mechanix2Go Date: December 18, 2008 at 01:49:54 Pacific
Reply:
@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.
Summary: I am trying to create a batch file that will look in a directory, gather all of the subdirectories that contain 'DATA' in the directory name, and then output to a log file the subdirectory names and f...
Summary: Hello again batch friends. I have lots of text files in a folder that are lists of ingredients that are always in the following format... 2 Layer Banana Cake Servings 1/2 Cup oil 2 3/4 Cup whole whe...
Summary: I need the size of folders in kb,mb gb... or just b... dir doesn't list the size of folders, only files. for example: on linux I can type du -h --max-depth=1 /home/js/dir.txt and that gives me the siz...