Search Using Wildcards On a Mac

While it may not seem like you can use wildcards in a Spotlight search on a Mac, you can use a variety of options to get the same result with a normal search, and then regular wildcard searches when using Raw Query as your search type.

Comments: 14 Responses to “Search Using Wildcards On a Mac”

    SteveH
    2 years ago

    Gary, I'm forever amazed at the depth of knowledge you demonstrate on a daily basis. Where you discover all these life-saving goodies is beyond me. The only way to make this wildcard subject even better is; perhaps you'd be willing to create a cheat sheet.

    Joe Grillo
    2 years ago

    I agree with SteveH's comments. I usually learn a lot with your vignettes and this was one of the better ones for me. One thing I was really looking for was the next level search ie how do I search a pdf for a word.
    Good job - Thank you

    2 years ago

    Joe: In general, just search for the word. The most basic search in the Finder will look for the name and contents. So if the a word appears in a PDF, it should show up. Of course a PDF could contain images with words printed on them instead of actual text, so it may look like it contains that word, but in fact it only contains an image with the word on it. Or, sometimes PDFs can be locked or protected so they can't be indexed.

    Senor Wheel
    2 years ago

    Searching in the Finder is super easy. How do you list certain files in a directory in Terminal using wildcards?

    2 years ago

    Senor: You could do that with something like this, which would show all files ending with .txt

    ls *.txt
    Corky
    2 years ago

    How do I find non-blank fields?
    Specifically, I want to find all cards in Contacts that have text in the Notes field.
    The Search for "is set" option does not work. Once a field "is set" to any value the field always has a "is set" status even if all data in the field is deleted.

    2 years ago

    Corky: Not sure if that is possible. You may just have to flip (arrow key) down the list and see which notes have text in them. Or, export to Numbers and look there in the Notes column.

    JC193
    1 year ago

    Hi Gary - thank you for your videos.

    I have done raw queries using wildcards, but also wish to search for files modified within a specific date range. I can see kMD... ideas, but I cannot find the syntax to actually type in a date.

    Can you post a link or advise how to search for files modified within last 30 or 100 days of today, and for files modified between say 18 January 2020 and 17 February 2020 for example please?

    Many thanks,
    J

    1 year ago

    JC193: You would need to use things like kMDItemFSContentChangeDate and kMDItemFSContentChangeDate, but it is difficult to enter those values. It is much easier if you just add normal search criteria for the dates in the Finder window. So use the wildcard search, and also add Date Modified once or twice to narrow the dates.

    JC193
    1 year ago

    Hi Gary,
    Thank you for your reply. I was hoping to avoid 'building a search' in Finder as this exercise is something I repeat every quarter and annually for a certain set of files on my computer. If I could save the syntax so that I could cut and paste it into future raw queries, rather than having to start from scratch each time it would be quicker, but I haven't found an obvious way to do it yet.
    However, thanks to your videos etc I am now able to get the info I need - many thanks. J

    1 year ago

    JC193: Then use a Saved Search (AKA Smart Folder). https://macmost.com/creating-convenient-saved-searches-for-your-mac-finder-sidebar.html You can easily edit it every quarter to change the dates.

    Christopher Feldmann
    1 year ago

    I have a template project folder I duplicate for each of my video projects. All my exports go to an "OUTPUT" folder for that specific project. I want to look at all the video files in all the OUTPUT folders in a directory and use that search to quickly see all the old versions that can now be deleted. Is there a kDM lookup rule for file paths? is there a list where I can find the different kDM identifiers?

    Christopher Feldmann
    1 year ago

    I'm so sorry - please replace any use of KDM above request with "kMD"- goodness

    1 year ago

    Christopher: No way to use path in a search like that. Join the long line of people frustrated by that over the decades.

Comments Closed.