Searching files in Windows with Powershell
06Aug09
The new (well, not that new now) Windows search is way annoying, so I thought may be I could use Powershell for searching. This is how to do it (best do it on one line):
foreach ($file in get-Childitem . -include *svn* -force -recurse)
{ $file.fullname }
The -force is to make it include the hidden files in the results. A bit shorter, but arguably less readable if you don’t know Powershell:
get-Childitem . -include *svn* -force -recurse
| foreach ($_) { $_.fullname }
I bet you can go even shorter, I don’t really know Powershell, though it loos very, very powerful. Naturally.
Anyway, now I can do what I originally intended and blast all the svn info from my project, like so:
get-Childitem . -include *svn* -force -recurse
| foreach ($_) { remove-item $_ -recurse -force }
Advertisement
Filed under: programming | Leave a Comment
Tags: Powershell, Windows
No Responses Yet to “Searching files in Windows with Powershell”