ffind and directories

I thought that

ffind /a:d /s Foo

would let me find all directories named "Foo", but it doesn't seem to always do that. Can anyone explain the results below? I find them inexplicable. E.g., why should searching for "Foo*" find Foo, but searching for "Foo" doesn't?

C:\Junk>dir

Volume in drive C is OS Serial number is 1ce5:1203
Directory of C:\Junk\*

3/05/2010 12:45p DIR .
3/05/2010 12:45p DIR ..
0 bytes in 0 files and 2 dirs
205,416,271,872 bytes free

C:\Junk>mkdir Foo

C:\Junk>ffind /a:d foo

0 files

C:\Junk>ffind /a:d foo*
C:\Junk\Foo

1 file

C:\Junk>mkdir Foo\Bar

C:\Junk>ffind /a:d /s bar
C:\Junk\Foo\Bar

1 file

C:\Junk>mkdir Foo\Aaa

C:\Junk>ffind /a:d /s bar
C:\Junk\Foo\Bar

1 file

C:\Junk>ffind /a:d /s bar*
C:\Junk\Foo\Bar

1 file

C:\Junk>Foo\

C:\Junk\Foo>ffind /a:d bar

0 files

C:\Junk\Foo>ffind /a:d /s bar

0 files

C:\Junk\Foo>dir

Volume in drive C is OS Serial number is 1ce5:1203
Directory of C:\Junk\Foo\*

3/05/2010 12:46p DIR .
3/05/2010 12:46p DIR ..
3/05/2010 12:46p DIR Aaa
3/05/2010 12:46p DIR Bar
0 bytes in 0 files and 4 dirs
205,416,271,872 bytes free

C:\Junk\Foo>ffind /a:d /s bar*
C:\Junk\Foo\Bar

1 file

C:\Junk\Foo>ver /r

TCC 11.00.40 Windows Vista [Version 6.0.6002]
TCC Build 40 Windows Vista Build 6002 Service Pack 2
Registered to davidmarcus - 1 System License
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,470
88
Albuquerque, NM
prospero.unm.edu
I think what's happening is that, if your argument names a directory (either in the current directory, or fully qualified), then FFIND automatically appends a \* for you. So, if you have a subdirectory named FOO within the current directory, then FFIND FOO works out the same as FFIND FOO\* -- list all matching items within FOO. (BAR and AAA in your example; try it.)

Using wildcards prevents the argument from matching a specific directory name; FFIND FOO* can't search within the FOO* directory, because there is no such directory. You might not want the asterisk, since it would also match FOODPOISONING and FOOLONTHEHILL and you don't care about them. A more specific wildcard such as FO[O] or FOO[] will match only FOO and not those others -- I suspect this is what you really want.


Or maybe it's just your own darn fault for using protomatter in the Genesis matrix.
 
Similar threads
Thread starter Title Forum Replies Date
J ffind does not find files Support 4
D ffind hangs on large file Support 18
Alpengreis ffind dialog (/W) problem Support 4
vefatica FFIND, temp files? ... not deleted? Support 0
S FFIND text that includes " Support 7
D ffind /e hangs Support 7
vefatica FFIND needs work Support 12
Joe Caverly Multiple Text Searches at once using FFIND or TPIPE Support 4
Kachupp FFIND TPIPE Support 9
Gamegod ffind bug with chinese Support 2
vefatica FFIND and multi-line regular expressions Support 4
vefatica Make FFIND a bit more friendly? Support 14
M Trying to use ffind with a @file.lst doesn't work Support 4
vefatica Corruption from FFIND? Support 5
vefatica FFIND /S and System32? (and an OT mystery) Support 14
T FFind - can we display n number of lines after the find? Support 2
vefatica Help nit (FFIND and DIR with /S) Support 0
R ffind not setting %_ffind_ vars if /f is used Support 7
M FFIND wordA AND wordB Support 4
vefatica FFIND and _? Support 1
B Fixed FFIND doesn't find last character in file without CR/LF at EOF Support 1
dcantor How to make line numbers fixed width in FFIND Support 11
vefatica FFIND /S, find directory with specified name? Support 7
D Why doesn't ffind find directory? Support 3
C FFind /w works but FFind /= doesn't? Support 2
vefatica FFIND goes crazy Support 8
Stefano Piccardi TCC 13 vs. TCC 14 different FFIND /E"d$" output Support 1
Steve Pitts How to? FFIND, regular expressions and double quotes Support 4
vefatica FFIND /S in my profile directory Support 2
A How to? Pass output from ffind to another command in a BTM file Support 5
Phileosophos Can FFIND match file names with a regular expression? Support 19
vefatica FFIND and size ranges Support 1
R How to use ffind to find older files? Support 9
J How do I - ffind - with multiple items Support 10
M FFIND and LIST does not work for UTF-8 fles Support 10
C FFIND ERRORLEVEL Support 2
L FFIND no result display Support 10
H Directory wildcards not working with ffind Support 3
Stefano Piccardi detecting BOM, FFIND multibyte regex Support 18
dcantor FFIND syntax -- is /E"regex" /X supported? Support 2
S FFIND and quoted strings Support 4
S FFIND /E"reg exp" : not case insensitive Support 4
J Problem with FFIND Support 1
gworley Virtual network drive filename completion doesn’t get directories Support 0
thorntonpg sync /S /F creating empty directories Support 5
WadeHatler pdir broken in 19.1 for directories with spaces Support 1
P Color directories in Win10 build 10586 console Support 11
R How to? Name completion only of directories? Support 3
fromano How to? Everything finding directories with 2 or more files in them Support 3
M Problem with Extended Search and non-ASCII characters in directories names Support 3

Similar threads