1

I created a workflow like this after asking another question:

enter image description here

It should delete downloads older than 30 days, and has been working fine until today; today I updated to macOS High Sierra.

Now whenever the Application tries to run I'm getting the error

enter image description here

The action "Filter Finder Items" encountered an error: "Unable to search with Spotlight"

How can I fix my workflow so that it works with this latest version of macOS?

  • When I tried to setup something similar, I caved in pretty fast with folder actions not working half the time and what ever... So I took the easy route and bought Hazel. I also use Path Finder, which has the ability to easily show hidden files. So I made a folder in downloads called _old, hid it with chflags command. Then I set a rule in Hazel: if Date added is not todayMove to folder _old. – Joonas Oct 5 '17 at 7:03
  • This basically makes it so that my download folder only contains files from today and if I need to dig deeper, I can show hidden files and view the contents of _old. I guess you could also put the _old folder in the sidebar or favorites, to avoid having to show it every time. This obviously doesn't save any disk space, it just makes it easier to manage downloads. You could tell hazel to trash the files too. – Joonas Oct 5 '17 at 7:03
  • @Joonas Hazel costs money for something that Automator should be able to do just fine anyway – theonlygusti Oct 5 '17 at 7:04
  • That is true. I didn't say it was a necessity, I said it was the easy route. – Joonas Oct 5 '17 at 7:05
  • As a temporary workaround, I'd use the find command in a new Automator workflow... add a Run Shell Script action (settings Shell: /bin/bash and Pass input: to stdin), replace the default cat with find "$HOME/Downloads" -maxdepth 1 -type f -mtime +30d -iname '*.*', add a Move Finder Items to Trash action, save as an application. This does not traverse subdirectories, so as to avoid something Safari is downloading at the time it's run, as it uses a .download bundle which is a directory. Continued in next comment... – user3439894 Oct 5 '17 at 10:21
0

As a (temporary) workaround, I'd use the find command.

In a new Automator workflow, add the following actions:

  • Run Shell Script

    • Settings - Shell: /bin/bash and Pass input: to stdin
    • Replace the default cat with:

      find "$HOME/Downloads" -maxdepth 1 -type f -mtime +30d -iname '*.*'
      
  • Move Finder Items to Trash

  • Save the workflow as an application.

Note: As coded, this only deletes files at the directory level of ~/Downloads. It does not traverse subdirectories, so as to avoid deleting something Safari is downloading at the time it's run, as it uses a .download bundle which is a directory. You could devise a more complex find command and or workflow, however this, as is, is better then your current nonfunctioning workflow.

1

I think I just figured out the problem and it is laughably stupid.

When filtering by extension, you mustn't include the "." in the filter criteria.

So, in your case, filter by IS NOT: "download" instead of ".download"

I love Automator, but sometimes it is hard to follow its logic.

  • are you on macOS High Sierra 10.13.3? – theonlygusti Mar 16 '18 at 9:48
  • and you've tested this? – theonlygusti Mar 16 '18 at 9:48
  • because the error doesn't sound like an error in file extension, e.g. when searching in Finder for the extension .download it doesn't error it just returns no results or w/e. The error in the question is more like something is just wrong with spotlight – theonlygusti Mar 16 '18 at 9:49
  • Yes, I'm on 10.13.3 and I've tested this. Not sure why it calls the error "Unable to search with Spotlight," as that really makes no sense, but I've repeatedly tested this and every time I filter by extension in Automator, it is the same. Include the "." and you get this same error, omit the "." and it processes the files absolutely fine. Finder without an error, as you say, this seems to be an Automator issue only. – pHghost Mar 16 '18 at 13:09
  • Did you have a chance to try it? Did it solve your issue as well? – pHghost Mar 19 '18 at 23:51

You must log in to answer this question.

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