1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Support' started by mathewsdw, Sep 20, 2011.

  1. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    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?
     
  2. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    648
    Likes Received:
    1
    re: A simple question related to the "dir" (and "pdir") commands...

    Maybe "ffind /a:d /s DirName".
     
  3. dbartt

    Joined:
    May 29, 2008
    Messages:
    36
    Likes Received:
    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
     
  4. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    re: A simple question related to the "dir" (and "pdir") commands...

    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!
     
  5. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    re: A simple question related to the "dir" (and "pdir") commands...

    Dennis, that works great!!!! How ever did you figure that out?
     
  6. dbartt

    Joined:
    May 29, 2008
    Messages:
    36
    Likes Received:
    0
    re: A simple question related to the "dir" (and "pdir") commands...

    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.
     

Share This Page