4

I have a camera setup were the camera automatically takes pictures every x seconds and these images are saved in a directory called 'Images'. Now I want to create a smart folder that looks in 'Images' and only lists images that were added in the last 5 minutes. When creating a smart folder, I see only the option the list files from the last day.

How can I create a smart folder that lists only files created in the last 5 minutes?

In other words, I want to create a smart folder using non-standard options.

  • 2
    Don't know about smart folder, but you can always make a regular folder and have a script running in background which makes symlinks to 5 newest images. – Sergei Jun 21 '14 at 13:32
10

A 'Smart folder' is in principle a XML formatted file that, when opened, returns a Spotlight search result. To create a Smart folder you can add multiple search terms by pressing the + (or alt+). For example, you can choose to only return files that where created in the last 7 days. Although there is a profusion of search terms, some are still missing (like searching within the last 5 minutes).

The commandline version of Spotlight is mdfind (manual). Although harder to use, mdfind commands are more flexable than the Smart folder/Spotlight alternative. You can, for example, search for files that were created in the last 5 minutes like this:

mdfind 'kMDItemFSCreationDate > "$time.now(-300)"'

Or were changed in the last 10 minutes:

mdfind 'kMDItemFSContentChangeDate > "$time.now(-600)"'

Fortunatly Smart folders support the mdfind command! To use mdfind search commands do the following:

  1. Go to Finder and press CommandF to start a new Smart folder.
  2. In the search-items bar you can select 'Other...' from the drop down menu. Search for 'Raw query' and add it to your search terms

  3. Now enter your mdfind search query in the empty text field

    kMDItemFSCreationDate > $time.now(-600)
    
  4. Save your search and you are done.

Other dropdown menu smart folder Smart folder raw query

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .