I have a conundrum here at work. I have a series of subfolders that are named by year and month. i.e. 200602; 200603 … 200902 where we put files that related to that particular year month combo.
I’m looking for a way to find a file, but I only want to look in the folders 200801 to 200902. I know part of the file name so I can pattern matching. Is there any way to limit a search to some directories in hierarchy but not all of them?
From my perspective I only have two choices, searching once for each directory I want to look in, or search ALL of the directories of the same hierarchy with the ‘search subfolders’ option turned on.
I’m not against using command line, but I don’t see any switches in the dir command that allows me to do something like dir 2008**fileA.txt
Quartz’s idea will do everything from 200601 to 200912. That’s not quite what you asked for, but is certainly on the right track.
There’s not a super-easy way to do just the ones 200801 to 200902. But that’s only 13 entries, so we can stand to just enumerate them in code.
c:>for %d in (200801 200802 200803 200804 200805 200806 200807 200808 200809 200810 200811 200812 200901 200902) do dir %d\{file name pattern goes here}
will do your job for you.
If you needed, say, 30 contiguous months out of a period of 10 years, we could add some more algorithmic stuff, but for 13, that’s be worse than this is.
Create a new temp folder, move those 13 subfolders into it, and then search it. When you’re done, move those folders back from that temp folder to their original spots.
That’s exactly what mine and other suggestions do. Obviously you can change the 8 to a 9.
I got the impression that the OP limited it to 200902 simply because there is no 200903 directory yet.
To me, it looks like you have 14 specific folders you want to look in. I would copy those folders to a new temporary folder, and then just search that entire folder.