I am trying to find the answer to the following question. I have been trying to list the directory trees that do not contain the folder "sample" at a given depth. The depth level will always be the same and I have been able to list all folders that contain the given folder by the following command however I can't seem to figure out how to list the directory trees that don't contain the folder.
Here is the code I am using so far:
Code: Select all
@echo off
pushd e:\tv\
for /f %%a in ('dir /s/b/ad') do (
if /i "%%~na" EQU "sample" echo %%a >>c:\temp.txt
)
Again this code will produce all directory trees that contain the given folder, and will leave out the the ones that don't. If I switch the "EQU" to "NEQ" it will produce a list, but not at the proper depth level.
Example: - this will be my output from the script with "EQU"
When I switch the code to "NEQ" it will give me all folders including the ones with that sample folder in it.
I just want to produce a list of directories that do not contain the Sample folder on the 6th folder deep.
Thanks for your help.