As developers, we often need to quickly locate specific folders in complex directory structures - whether it's searching for node_modules
directories to clean up or finding project root folders. While Windows Explorer sorts folders to the top by default, this isn't always sufficient when dealing with thousands of items.
The solution lies in Windows' Advanced Query Syntax (AQS). Here's the magic search term:
System.Kind:folder
Type this directly into Windows Explorer's search bar to filter exclusively for folders. The search is recursive by default, scanning all subdirectories.
Combine this with other filters for powerful queries:
System.Kind:folder AND name:config
Finds all folders named "config" in your project hierarchy.
System.Kind:folder AND datemodified:thisweek
Locates recently modified directories - great for tracking down where you saved that experimental branch.
For automation, use this in PowerShell:
Get-ChildItem -Recurse -Directory | Where-Object { $_.Name -like "*test*" }
Or for a GUI-like experience:
explorer.exe "search-ms:query=System.Kind:folder&crumb=location:C:\projects"
Create reusable folder searches:
- Perform your folder search in Explorer
- Click "Save search" in the toolbar
- Name it (e.g., "All Python Virtualenv Folders")
Now you can quickly access this filtered view anytime.
For large codebases, consider:
- Indexing your project directories in Windows Search settings
- Using
depth:
modifier to limit recursion - Excluding build artifacts from indexing
Remember that the first search might be slow, but subsequent searches will benefit from the index.
html
While Windows Explorer automatically sorts folders to the top in search results, many developers need more precise control when searching through complex directory structures. This becomes particularly important when:
- Working with large code repositories
- Managing build output directories
- Organizing project assets
- Cleaning up temporary folders
Windows Explorer supports Advanced Query Syntax (AQS) for refined searches. The key operator for folder searches is:
kind:folder
This basic filter can be combined with other search parameters for more targeted results.
Here are some commonly used folder search patterns:
# Find all folders named "bin"
name:bin AND kind:folder
# Search for config folders modified in last week
name:config AND kind:folder AND modified:thisweek
# Find empty folders
size:empty AND kind:folder
For developers who prefer scripting solutions:
# Basic folder search
Get-ChildItem -Path "C:\Projects" -Directory
# Recursive folder search with name filter
Get-ChildItem -Path "C:\Projects" -Directory -Recurse -Filter "*temp*"
# Combined with other attributes
Get-ChildItem -Path "C:\Projects" -Directory | Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-7) }
Save frequently used folder searches:
- Perform your search in Explorer
- Click "Save search" in the toolbar
- Store the .search-ms file in a convenient location
For better search performance on large drives:
- Ensure Windows Search service is running
- Index your development directories
- Avoid overly broad wildcards in name filters
- Consider narrowing the search scope when possible