Computing.Net > Forums > Disk Operating System > Getting Number of Files with DIR

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.

Getting Number of Files with DIR

Reply to Message Icon

Name: cassie82
Date: October 1, 2003 at 07:29:10 Pacific
OS: Windows
CPU/Ram: ??
Comment:

Hi,

I would like to get the number of immediate sub-directories there are for certain directories.

The command I am using now is

dir "dir_path" | find "bytes free" >> output.txt

This gives me a line of output, e.g.

13 Dir(s) 25,086,881,792 bytes free

What I would really like in the output file is to have just the number of directories, e.g. 13 in the example above.

Can anyone help pls?




Sponsored Link
Ads by Google

Response Number 1
Name: Miskva
Date: October 3, 2003 at 02:15:16 Pacific
Reply:

Maybe you could try this: if you manage to enter this line, as a series of parameters after calling a program:

program.bat 13 Dir(s) 25,086,792 bytes free

and then let the program.bat just perform: echo %1 .. this will then display "13"

Miskva


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Getting Number of Files with DIR

Count the number of files www.computing.net/answers/dos/count-the-number-of-files/13393.html

counting files www.computing.net/answers/dos/counting-files/12788.html

max number of files in folder? www.computing.net/answers/dos/max-number-of-files-in-folder/16064.html