ffind not setting %_ffind_ vars if /f is used

Oct 18, 2009
362
17
I'm using ffind with /s to search for one file in various subdirs.

If I use /s without /f, when the command completes %_ffind_files is set to 1. If I include /f, %_ffind_files is set to 0 even though there was one match.

It seems this is not a recent bug. I'm seeing the same problem in TCC 13 and TCC 18.
 
May 20, 2008
11,388
99
Syracuse, NY, USA
Apparently so. And what's the difference between _FFIND_MATCHES and _FFIND_FILES?
upload_2017-6-25_12-37-53.png
 
Oct 18, 2009
362
17
There is a point in doing it. (By the way, these are network drives, so Everything won't work.)

What I want to do is silently determine whether one particular file exists "somewhere" below \THR\Downloads\ I can accomplish "silently" by having the ffind output>NUL. Then I look at %_ffind_files to determine whether the file was found. If I don't use /F I have to wait for ffind to look through over 700 subfolders, all but 3 of which definitely won't contain files.

There is one folder for the year, 12 subfolders for the months, 1 subfolder in those for each day of the month, and each day subfolder has a \comments subfolder. After a day is processed, its folder is moved elsewhere. So on Jan 1 ffind would have to search 1 + 1 + 12 + 366 + 366 = 746 folders. Since Jan 1 would be near the top of the tree, with /F it stops almost immediately.

(By the way, even with setting /S to only search a specific level, it would still require searching up to 366 "day" folders.)

With /F, there is no way to tell just from looking at %_ffind_files whether ffind found something. %_ffind_files comes back 0 whether ffind found something or not. I would have to write the output of ffind to a temp file, then check whether the temp file has a length greater than 0, then delete the temp file.

For an unrelated issue I already use ffind to check the data file for the "bad" characters ; = < and >. When I found out TCC/LE doesn't set the %_ffind_ variables I had to use the write-to-temp-file-then-check-file-length-then-delete approach. But that workaround shouldn't be necessary with TCC.

Aside from that, the Help doesn't say anything about ffind not setting the %_ffind_ variables if the /F parameter is used. So someone expecting it to work would think their program has a bug elsewhere.
 
Oct 18, 2009
362
17
Incidentally, you might consider adding a /Q parameter, so the %_ffind_ variables will still be set but there won't be any screen output.

In both my "does this file contain bad characters" and "does this file exist somewhere" uses, I don't want anything displayed, I just want to know yes or no.
 
May 20, 2008
11,388
99
Syracuse, NY, USA
As Rex said, you can do it (silently) by checking the variable _? instead of the variable _ffind_files. It's no more work.
upload_2017-6-25_19-47-20.png

There's also @FILES[] which might do your job. Like FFIND, it has the unusual feature that path\file means search only path is "/S" is not specified, and means search path and subdirectories if "/S" is specified. @FILES returns the number found.
upload_2017-6-25_19-53-40.png
 
Oct 18, 2009
362
17
DON'T USE /F, USE /-1

That too causes it to stop after 1 match, but %_ffind_files does get set.

So ... the Help should be clarified that %_ffind_ are not set if /F is used but "stop after first match" can be accomplished by using /-1 instead if those are needed.

Thanks for you help everyone!
 
Last edited:
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
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
D ffind and directories Support 2
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
vefatica Setting array variable ignores leading spaces (and @execarray doesn't) Support 4
vefatica VIEW ... remember the UTF-8 setting? Support 0
S Setting Tabs=Bottom makes text turn black Support 6
rps TCMD Tabs priority option setting Support 0
C How to? Setting up SMTP access for Yahoo with TCMD v20 Support 7
Alpengreis WAD Each start/close of TCMD changes my Explorer setting Support 7
J Variable setting regression in tcc17 ? Support 5

Similar threads