Total Downloads

2,601,502

Total Files

9,206

Latest Update

10

macOS: How to use Spotlight’s query language to create an All My Files-like feature

Posted April 3, 2018 | Mac


Recently, I noted that the All My Files feature present in macOS for several releases until macOS 10.13 High Sierra, had disappeared, replaced by an inferior Recents display—and that it couldn’t be restored. A Macworld reader wrote in to note that with the use of Spotlight’s lightly documented underlying query language, you could restore the function.

I avoided this in this previous column for two reasons, but if you’re willing to go through some configuration and picky details, you could find it worthwhile. First, it requires learning some programming-like syntax to construct a query, and even the tiniest error in typing or construction will keep it from working without any errors that give you clues of how to fix it. That can be frustrating, but I can at least provide the recipe to paste in. Second, depending on the age of your Mac and how many files on yoru drive, the All My Files replacement could take a long time to run or update, or even slow the Finder down.

With those provisos, here’s how you do it. Spotlight has an underlying “raw query” language for which Apple last updated the documentation in 2011. This language lets you specify a search parameter that’s not available through a preset popup menu selection in Smart Folders in the Finder.

  1. In the Finder, open a new folder and click the Recents item in the Sidebar.
  2. From the gear menu, select Show Search Criteria.
  3. In the field next to Raw Query, enter exactly the following: (kMDItemFSName="*.*")
  4. Click the Date Modified column to sort them from newest to oldest.
  5. Click Save.
  6. Name the search query All My Files, and check the box to put it in the Sidebar.

Note that above the query, the Spotlight constraint will show “Search: This Mac [Recents] Shared,” where Recents is selected. That limits the scope to document types in common locations instead of files found everywhere on your Mac. If you click This Mac, you’ll see the same query performed against the entire set of locally indexed files, which will include database files and other documents used for system and app purposes that you never need to know have changed and with which you don’t interact.

(You can also use these steps to get to a similar place, although it won’t be bound within the Search: Recents parameter.

  1. Choose File > New Smart Folder.
  2. Click the + next to Save.
  3. Select the pop-up menu with Name in it.
  4. Choose Other.
  5. Type Raw Query into the search field.
  6. Select the Raw Query match and click OK.
  7. Proceed from step 3 above.

The Smart Folder should populate fairly quickly with results. If it takes a long time or slows the Finder (or your Mac) down, you can limit the query, which should speed it up. If you wanted to get all files modified in the last week, you could change the query above to:

(kMDItemFSName="*.*") && (kMDItemFSContentChangeDate >= $time.this_week(-1))

IDG

The Raw Query field doesn’t show long queries, so you might want to type it in and edit it elsewhere to be sure it’s correct.

On Apple’s main documentation page, it describes how to define date ranges. You can string required conditions to the query with && with a space on either side. (Yes, two ampersands for “and” to connect conditions, not a single one, which does a binary comparison.)



Source link

')
ankara escort çankaya escort çankaya escort escort bayan çankaya istanbul rus escort eryaman escort ankara escort kızılay escort istanbul escort ankara escort ankara escort escort ankara istanbul rus Escort atasehir Escort beylikduzu Escort Ankara Escort malatya Escort kuşadası Escort gaziantep Escort izmir Escort