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

May 24, 2010
855
0
Northlake, Il
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?
 
May 29, 2008
37
0
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
 
May 24, 2010
855
0
Northlake, Il
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!
 
May 29, 2008
37
0
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
Thread starter Title Forum Replies Date
M Maybe Maybe I'm being stupid (again), but a simple question... Support 4
M How to? A very simple question re. the current line number in a batch file... Support 2
C Simple .bat question - dump contents of 2 dimensional array Support 2
M Another simple question re. Take Command/TCC window witdth in characters... Support 16
M Simple question about "Function" command... Support 4
P "Simple question" concerning insert/overstrike mode Support 17
samintz How to? TPIPE /simple=61 Support 6
GermanDirk How to? EVENTLOG Command with simple User Rights not functional Support 4
H TPIPE /simple=4 Support 12
T How can I send a simple parameter to a script, in tc 25? Support 2
C No simple way to tell new Alerts Support 8
P Simple RegEx copy Support 9
C WAD tpipe /simple=28 Support 8
C tpipe /simple=28 error Support 5
P WAD TC 15.0.1.58 x64 crasches with a simple dir command Support 18
M What am I doing wrong in this (very simple!) code? Support 3
D Some feedback on simple batch file Support 2
C forum Posting Question... Support 3
C question re: Move Support 3
S How to? Upgrade Question: What supporting documentation is required at time of purchase? Support 2
Peter Murschall Documentation Question to %@PSHELL Support 4
Fross Tab Question Support 6
Fross Quick Function Question Support 17
Dick Johnson Question about the Touch command Support 0
rps Documentation "Copy+Paste+run" question Support 2
vefatica SFTP question Support 17
vefatica Question about IPWorks Support 0
C How to? SHORTCUT question..... Support 6
vefatica TPIPE, crash and question Support 1
C Question / Suggestion Support 1
MickeyF Another TPIPE question Support 6
vefatica Another @EVERYTHING question Support 4
mikea How to? %@everything[] question Support 10
A License Question for Single User Support 5
Jay Sage Help Correction (and Related Question) Support 0
S Elapsed time in TCC prompt question Support 0
H command line parsing question Support 5
C Forum question Support 2
B Newbie here, I have a question. Support 4
J Dumb Question ... Support 4
Timothy Byrd Updating from TC 9 to TC 17 - TCTOOLBAR question Support 2
M A possibly stupid question about the "del" command... Support 7
M A just out of curiosity question re @DiskTotal Support 4
Fross Status Bar Time Question Support 1
A Stupid, obvious question - launch a BAT with TC Support 10
C How to? GLOBAL question Support 5
vefatica OT: VisualStudio question Support 1
vefatica Wildcard question Support 4
Dan Glynhampton v15 installer question Support 2
C Move question with Encrypted file... Support 6

Similar threads