DIR | FINDSTR Syntax file size query

Trying to search local drive for all files that are over certain byte size.   (Win7 64 CMD Prompt)

This nearly does what I want except it displays files smaller than than 10,000,000 bytes:

D:\>dir /a-d /o-s /n /-t /s| findstr /i [##,###,###]
13/01/2010  04:09 AM        39,312,785 Setup.exe
07/07/2005  01:36 AM         1,377,856 AutoRun.exe   >  I only want to view files with byte size over 10,000,000
               4 File(s)     39,690,748 bytes

This is what I thought should be correct syntax but it just hangs console hosts and displays lots of garbage until I kill conhost.exe

D:\>dir /a-d /o-s /n /-t | findstr /i /c:" *\[##,###,###\]" *
>No results

What am I doing wrong here? Is there a better way of doing this?

Thanks in advance.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Steve KnightConnect With a Mentor IT ConsultancyCommented:
I think what you are looking for is

@echo off
dir /a-d /o-s /n /-t | findstr /v "Dir(s) File(s)" | findstr /r "[0-9][0-9],[0-9]*,[0-9]*"

though we can also do it by scanning down the files using a for loop if needed to get more info. etc.

Add a /s to the dir for subdirs too. but as it stands it won't tell you the foldername

Steve KnightIT ConsultancyCommented:
BTW I have a script here on my site which gives you the 20 largest files in a structure which is where I would start amending a script to just pull out all the > 10Mb ons:

FreezingPeteAuthor Commented:
Legend, spot on.

I want to create an alias which runs the command to display largest files in directories searched ... I know there are explorer plugins to do so though I'd rather stick with the cli if possible.
Will use your script and modify as required, thanks heaps. The penny has certainly dropped after seeing your syntax!
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Steve KnightIT ConsultancyCommented:
I had to think about it for a minute myself, hadn't thought of doing it that way before either!

No problem, and if you need any more you know where we are.

FreezingPeteAuthor Commented:
Cool, thanks.
Now I'm thinking along the lines of;
Tree listing of directories and files > dir.out
File search and string filter > filter.out
delete strings in filter.out from dir.out
File search and string filter >> filter.out

! Somehow getting the corresponding large file sizes displayed to the right of the files.

Then I plan on running it batch file from an alias which will display directories containing large files and what they are called.

In my case I know the particular areas I want to search, it just saves a lot of seeiing where.
Steve KnightIT ConsultancyCommented:
A good question.... if you want to raise a Q for this we can always work through it (and plenty of other good people here too under Windows Batch / MSDOS area best probably).

Rather than using the dir output you can use a FOR command and get the file sizes etc. for each file along the way, it kinda depends on the number of files involved (i.e. a file server shared area is going to take a while to process), what the criteria are etc. but of course 'anything' is do-able.

All Courses

From novice to tech pro — start learning today.