Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Search: Can you search for a folder that's missing a filetype?

24 Nov 2014   #1
chrisdukes

Windows 7 64bit Enterprise SP1
 
 
Search: Can you search for a folder that's missing a filetype?

Basically, I want to search for all the folders on my drive that are missing an *.xmpb file. All of the folders should have one, but some of them don't, so I need a list of those folders. What's the syntax? I tried--

kind:folder NOT *.xmpb

--but it didn't work. Also, this is on a mapped network drive but that's never interfered with my searches before.

Thanks for any help, you'll be seeing me.


My System SpecsSystem Spec
.
24 Nov 2014   #2
Kari

Microsoft Community Contributor Award Recipient

 

Hi Chris, welcome to the Seven Forums.

It can't be done with Windows Search. The search you tried (kind:folder NOT *.xmpb) lists all folders where the folder name does not contain string .xmpb.

However, what you want to achieve is totally doable with a simple batch file:

1. @echo off
2. for /d /r %%x in (*) do (
3. if not exist %%x\*.xmpb (
4. echo %%x >>X:\FolderList.txt
5. )
6. )

Batch explained:
  • Line 1 > Disable output to console while running the batch
  • Line 2 > Check folders in current location and recursively down the whole folder structure
  • Line 3 > If a folder does not contain a file matching *.xmpb (change to whatever you need) ...
  • Line 4 > ... add the folder name and path to X:\FolderList.txt list (change the drive and text file name to what you want to)
  • Line 5 > Repeat 3. checking the next folder until the whole folder tree has been gone through
  • Line 6 > Quit
The above example has line numbers to match explanations below it. Here's the same code without line numbers, copy & paste this to a new file in Notepad and save with *.bat extension, naming it as you wish (AnyName.bat):
Code:
@echo off
for /d /r %%x in (*) do (
if not exist %%x\*.xmpb (
echo %%x >>X:\FolderList.txt
)
)
Now run the batch in Command Prompt in root of the drive or top of the folder tree which you want to check.

About FOR loops in batch files: For

Kari
My System SpecsSystem Spec
25 Nov 2014   #3
chrisdukes

Windows 7 64bit Enterprise SP1
 
 

This is awesome, Kari. Thanks a bunch, it works exactly as you said.

I have a few questions:
What's a good site to learn more about making batch files and advanced searching? (I bookmarked MS Technet)
How would I change line 2 so only the first sub-level of folders is searched? (I'm looking over Technet)
And, how can I see it process in the command prompt window?

Thanks again for your help and patience!
My System SpecsSystem Spec
.

25 Nov 2014   #4
Kari

Microsoft Community Contributor Award Recipient

 

Quote   Quote: Originally Posted by chrisdukes View Post
What's a good site to learn more about making batch files and advanced searching? (I bookmarked MS Technet)
This is one of the best batch guides I know:Tutorials for Windows Search:
Quote   Quote: Originally Posted by chrisdukes View Post
How would I change line 2 so only the first sub-level of folders is searched? (I'm looking over Technet)
The recursive switch /r (highlighted in code sample below) is the one which tells the batch to go through all subfolders down to last level in folder tree. Take it away to only go through first level subfolders:
Code:
@echo off
for /d /r %%x in (*) do (
if not exist %%x\*.xmpb (
echo %%x >>X:\FolderList.txt
)
)
Quote   Quote: Originally Posted by chrisdukes View Post
And, how can I see it process in the command prompt window?
Command echo off turns output to console (Command Prompt) off, the preceding @ sign turns off displaying the echo off command itself. Cut the whole command out (highlighted in below code sample) to see normal command output in console:
Code:
@echo off
for /d /r %%x in (*) do (
if not exist %%x\*.xmpb (
echo %%x >>X:\FolderList.txt
)
)
Quote   Quote: Originally Posted by chrisdukes View Post
Thanks again for your help and patience!
You are welcome .

Kari
My System SpecsSystem Spec
Reply

 Search: Can you search for a folder that's missing a filetype?




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Search Box missing in IE9
I see that this problem has been discussed:confused: for over a year. HOWEVER, I just installed IE9 a week ago (previously used Firefox) and despite what everyone says, the address box does NOT work for searching. Has anyone found a way around this "great" new innovation by IE?
General Discussion
How to remove search for computers and search for people start menu
Hello all first post so go easy :) i am trying to discover if there is a registry hack that will remove the search for computers and search for people links from the search tab on start menu (windows 7), any help greatly appreiciated. kind regards Uraken
Performance & Maintenance
Forum Search issue: Google search links don't work Fx 5.0
Hi: Not sure if this is the correct place to post, so please move, as needed. New problem just appeared: Google search links ONLY HERE AT THIS FORUM don't work in Firefox 5. Same links work fine in IE9. Absolutely zero/none/nada issues with Firefox 5 anywhere else, including every other...
Chillout Room
Windows 7 search files and folders vs Outlook 2007 search
Hello, Can someone tell me some specifics and pinpoint the differences (or maybe a good website) that would pinpoint the differences between the Windows 7 search and the outlook 2007 search? I know the outlook search searches through email but are there other difference I am overlooking between...
General Discussion
Search missing..
i have read some thread about this problem before.. i follow 1 by 1 how to fix it..but it's not work for me..i still have this problem i used windows 7 fatality GX 64bit..i had some problem whit this search features missing on my start menu and my explorer..:( i really need some help here......
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 20:45.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App