Saved Bookmarks
| 1. |
Solve : Counting no. of directories by running batch file?? |
|
Answer» HI All, I wanna create a batch file that counts the no. of directories in a particular path and write the result into a txt file. I am a novice in batch files. Though I am able to do it USING VB, I dont wanna do it via VB. My directory structure is somewhat like this: C:\Myfolders\A C:\Myfolders\B C:\Myfolders\C C:\Myfolders\D .............. .............. C:\Myfolders\Z Now in each folder from A to Z there are SUB folders staring from 1, 2... I want to have this count written in a text file like, Folder A 25 folders Folder B 34 folders ....... Please help... Thanks & Regards Newbie I assume you are running Windows 2000 or newer? Try this in a batch file: Code: [Select]@echo off for /f "delims=" %%a in ('dir /ad /b') do for /f %%c in ('dir "%%a" /ad /s /b ^| find "\" /c') do echo Folder "%%a" contains %%c sub-foldersThanks Guru. That was GR8. It solved my problem. Thanks again for your prompt reponse. No problem. Glad to help. |
|