Done Starting folder for ffind /s

Oct 18, 2009
214
8
#1
I'm trying to accomplish the following and ffind /s can't do it because it only searches for subfolders of the current folder. I'm looking for a filename ending with a date, and each day the file will be in a different subfolder 3 levels down from \Downloads.

%_cwd = F:\THR
Without changing the current folder, check for the existence of zcs_YYYYMMDD.txt in
F:\THR\Downloads\{year}\{month}\{day}

I could extract the date, parse it, convert month # to 06 Jun 2017, but I'd like something simpler.

When using /s, ffind should have an option to set the starting folder for the search.

Also, the help says there are options /s+3, -- start searching 3 levels down from %_cwd, and /s2 -- only search two sublevels. Is there a way to combine those two, i.e., "start searching 3 levels down from \Downloads (i.e., the {day} folders) and only search one level" ? If not, combining those is an additional suggestion.
 
Oct 18, 2009
214
8
#3
I addressed this in another thread. It finds folders, not a specified file. Also, it's looking for subfolders of the current working directory. I want to be able to look at subfolders of a different directory. The Help indicates ffind only looks for subfolders of the current working directory.
 
May 29, 2008
533
3
Groton, CT
#4
Looks to me like it works the way it is. TCC V20.11.46 x64 :
Code:
~\Work> ffind /s \scifi\x.txt
C:\scifi\cons\Boskone51\reg\x.txt
C:\scifi\cons\boskone52\reg\x.txt
C:\scifi\cons\Boskone53\reg\x.txt
C:\scifi\cons\Heliosphere2017\reg\x.txt
C:\scifi\cons\Lunacon_2016\reg\x.txt
C:\scifi\cons\Lunacon_2017\reg\x.txt

      6 files
 
Oct 18, 2009
214
8
#5
I tried a variation of the discussion in the other thread and it works. I was assuming that because I want a specific file in a subfolder of \Downloads it was necessary to include one or more subfolder wildcards, otherwise ffind would just look for \Downloads\myfile.txt

In \THR

[F:\CLIENT DOWNLOADS\THR] ffind /f /s "F:\CLIENT DOWNLOADS\THR\Downloads\zcs_20170622.txt"

F:\CLIENT DOWNLOADS\THR\Downloads\2017\06 - Jun 2017\24\zcs_20170622.txt

[F:\CLIENT DOWNLOADS\THR] ffind /f /s "F:\CLIENT DOWNLOADS\THR\Downloads\zcs_20170623.txt"
0 files

The on-line help needs to be changed--it is both inaccurate and misleading:

Part of the current /S Help:

Display matches from the current directory and all of its subdirectories. By default, FFIND processes only those subdirectories without the Hidden or System attributes. To view hidden or system subdirectories use /A along with /S.

That seems to say that if you are in folder C:\MyDir\ it won't search subfolders of D:\OtherFolder\ because D:\... is not a subdirectories of "the current directory."

Related to that, in the test example above the Help is not clear that you don't need something between the target file name (zcs...) and the "check subfolders of" folder. I thought that even with the /s parameter if I specified to search for \THR\Downloads\zcs_20170622.txt it would not search any folders below \Downloads unless I added a \Downloads\*\ or something similar--which doesn't work.
 
Last edited:
#6
The help could be changed rather easily.

In the syntax line, change "file" to "[target_directory\]file". And under "/S" change "current directory" to "target_directory" and maybe include an example.
 
Oct 18, 2009
214
8
#7
Those Help changes won't work. As I ran into, they give the impression that [target_directory\] is the final folder.

In my working example, I thought that ffind would only look for zcs_20170622.txt in the folder \Downloads\ because it would think I specified the full path. Either that, or it would fail because it would think I was saying "look in subfolders of \zcs_20170622.txt\" and I didn't specify the file to look for in the (non-existent) \zcs_20170622.txt\ subfolder.

[F:\CLIENT DOWNLOADS\THR] ffind /f /s "F:\CLIENT DOWNLOADS\THR\Downloads\zcs_20170622.txt"

I don't see how it could be easily explained without an example.

(There is also a separate issue that if you use the /f switch ffind doesn't set the %_ffind_ variables, so they always return 0 even if a match is found.)
 
#8
I've been using FFIND for 25+ years and it has always been quite simple. If the "file" specification does not contain a '\' it names the thing(s) you're looking for and the search happens in the current directory (the root of the search). If it does contain a '\', what's before the '\' names the root of the search and what's after the '\' names what you're looking for. Without "/S" only the root is searched; with "/S" the root and all its subdirectories are searched.