How to? Dir specific file search patterns with spaces in the pathnames?

Oct 18, 2009
340
15
Using DIR I need to display files matching 2 different patterns, including the full path in the spec, but the path has spaces, e.g.:

Display only these files:

F:\Last Week\temp\HFLIST.xlsx
F:\Last Week\temp\HFLIST.txt
F:\Last Week\temp\05-07-2019_Inventory.xlsx
F:\Last Week\temp\05-07-2019_Invoice.txt

They're all in one folder. The examples in the Help all have no spaces in the path name.
 
Oct 18, 2009
340
15
If figured it out

Code:
Set src_path=F:\Last Week\temp

dir "%src_path\HFLIST.*;*05-07*.*"

(In the example, the * before 05 will pull up all files that contain 05-07 somewhere.)
 
May 20, 2008
10,498
77
Syracuse, NY, USA
Use an include list ... (?)

Code:
v:\> dir /f v*.btm;c*.btm
V:\checkvip.btm
V:\collision.btm
V:\colors.btm
V:\vhd.btm
 
Oct 18, 2009
340
15
Use an include list ... (?)

Code:
v:\> dir /f v*.btm;c*.btm
V:\checkvip.btm
V:\collision.btm
V:\colors.btm
V:\vhd.btm
My question is specifically about use in a batch file, where the folder being displayed is not the current folder and there are spaces in the pathname. I see that it actually is an include list.

I haven't tried the below because at the moment I don't need it, but this would probably work too. (It might be necessary to put double-quotes around the semicolon separator.)

Code:
Set last_wk_path=F:\Last Week\temp
Set last_mon_path=F:\Last Month\temp

dir "%last_wk_path\HFLIST.*;%last_mon_path\*05-07*.*"
 
May 20, 2008
10,498
77
Syracuse, NY, USA
Of include lists, the help says:
Only the first entry in each include list may specify a path. All files in an include list must be in the same directory.
So I don't think you can get "f:\last week\..." and "f:\last month\..." in one DIR listing. You could:
Code:
dir "%last_wk_path\HFLIST.*" "%last_mon_path\*05-07*.*"
but as far as I can tell, that's the same as
Code:
dir ... & dir ...
 
Oct 18, 2009
340
15
Thanks all. I hadn't thought about it, but it wouldn't make sense to have files from multiple folders displayed in a single result laid out like a single-folder dir command with a single header block and a single footer block.

The code I'm using isn't intended to simply check whether files exist, it's specifically to display which files matching specific patterns are in the specific folder, so I can spot whether copies have been made, files that were supposed to be manually deleted or moved weren't, etc.