I am throwing together a batch file that will echo out a list of all of the directories in a specific path.
I have a few folders in the W:/wamp/www/
directory that start with an underscore _
; for example _templates
.
I would like the result to exclude any folders that start with an _
. I don’t need this effort to be recursive.
So my current directory for w:/wamp/www/
looks like this:
_system
_templates
_assets
Folder1
Folder2
Folder3
Desired echo output is:
Folder1
Folder2
Folder3
I can get a listing with a number count using the following but of course it throws all of the folders back at me. I’d appreciate any assistance. I don’t really need the numbers in this list so if there is a more elegant approach to this I would be grateful for the insight
set acctDir=w:\wamp\www\
set app=setup.exe /cd
set log=w:\wamp\logs\projectlogs.txt
set c=0
For /f %%a in ('dir !acctDir! /B /A /D') do (
set /a c+=1
echo !c! %%a
set dir!c!=%%a
set projectname=%%a
)
attrib +h w:/wamp/www/_*
, and the files will then be excluded from directory listings.