0

I need to search for the string 60 in some files. Many of these files are images. Is there a way to exclude by file extension while searching in windows explorer?

Or I suppose there's a way with powershell with ls -Recurse but that feels bad to me...

1
  • Also, why does windows keep sending me back up to the beginning of the search results when I'm halfway scrolling through them... :arg_face:
    – xdhmoore
    Mar 12 '20 at 4:21
1

Excluding an extension is easy enough in Explorer. In the Search box, type: extension:NOT .jpg

Is that strinfg part of the name or content? Is it separated from adjacent text by spaces or other non-alpha-numeric characters or is it butried: ...4603...? Try adding: name:60 or name:~"*60*" or content:60 to your extension criteria: enter image description here

enter image description here

2
  • I can't figure out how to follow these instructions because the taskbar is on the wrong side of the screen. JK, thanks. I didn't know about most of those.
    – xdhmoore
    Mar 12 '20 at 5:46
  • 1
    What about the Search bar in Explorer? Mar 12 '20 at 5:46
0

Ended up doing something like:

ls -Recurse -Exclude '*.png','*.jpg','*.jpeg' | sls 60

With a lot of other rigamarole thrown in to exclude directories, etc.

3
  • 1
    Exclude directories with the -FIle parameter: gci -file -recurse ... Mar 12 '20 at 5:45
  • Thanks, that's way better than my ? { Is-Directory $_ } shenanigans...
    – xdhmoore
    Mar 12 '20 at 5:46
  • 1
    You welcome. I went with the Explorer answer because you seemdd to imply PowerShell was less desirable. Don't know how familiar you are with it, but I've made an effort to learn it & really like it. There's great documentation, but consistency, tab-completion, .GetType(), and Get-Member make it easy to "play" and learn through discovery. But it's good to take the time to watch the MS video series: Getting Started with PowerShell. They'll give you an unparalleled grasp of the fundamentals that will serve you well. Mar 12 '20 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.