Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

A simple question related to the "dir" (and "pdir") commands...

May
855
0
I have a batch file (which makes this somewhat more important) that searches a drive for a particular directory, as in "%@ExecStr[arrayvariable,dir drive:\DirectoryI'mLookingFor /AD /S /F /H]", and while that absolutely does return the directory I'm looking for and its location, it also returns the names of all of that directory's subdirectories going down arbitrarily "deep", which I absolutely do not want or need. To sort of "get around" this issue I've been doing something to the effect "dir drive:\DirectoryI'mLookingFo? /AD /S /F", and that, of course, does pretty much work, but I find it to be kind of "ugly" and at least potentially inaccurate because it assumes that there is no other directory whose name differs from the directory I'm searching for by only the last character. Is there a better way to achieve exactly the results I'm looking for (i.e., the exact path of the directory that I am looking for and nothing else) other than what I've been doing until now?
 
A simple question (on a completely different subject) related to the "dir" (and "pdir") commands...

This should work:

dir /ad /s /f /h dirname[]

The trailing [] is needed to make it work right.

Dennis
 
re: A simple question related to the "dir" (and "pdir") commands...

Maybe "ffind /a:d /s DirName".
Thank you, Dave! I haven't actually tried it as of this moment, but from reading the "help" file it certainly looks like it will do the job. I don't know if this is good news or bad news (for me), but TCC has gotten so "large" and has so many capabilities that I (with my bad memory) can no longer keep track of it all!
 
re: A simple question related to the "dir" (and "pdir") commands...

This should work:

dir /ad /s /f /h dirname[]

The trailing [] is needed to make it work right.

Dennis
Dennis, that works great!!!! How ever did you figure that out?
 
re: A simple question related to the "dir" (and "pdir") commands...

> Dennis, that works *great!!!!* How ever did you figure that out?

From the following quoted from the help for the DIR command:


To display only those files which do not have descriptions, use: dir /I"[]"


That led me to experiment and I found the [] syntax could be used to mean
"nothing there". I've been using it for years in a btm file to locate the full
path to all "temp" directories on my system while ignoring any lower level
directories.
 

Similar threads

Back
Top