0

I am using automator to move all finder items in a location to trash if their last date modified is after 2 weeks from today.

The workflow is as follows:

Get Specified Finder Items (an external hard drive) - works well

Get Folder Contents (repeat for each subfolder found) - works well

Filter Finder Items (all that are not a folder) - works well

Filter Finder Items (all whose date modified is not in the last 2 weeks) - DOES NOT WORK This passes all the items to the next process without any being filtered

Move Finder Items to Trash - works well

I am able to make this workflow work correctly if the condition for the Filter is set to "All items whose date modified is after a specific date". Here, I manually input the date which is 14 days before today.

Can anyone explain why these two functions cause the filter to behave differently when they are essentially the exact same thing?

I want to have the 2 week condition so that I can run the workflow without having to edit it every time.

Thanks! Cake

1

I'd use the find command instead.

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 "/Path/To/Directoty" -type f -mtime +14d -iname '*.*'
      
    • Change "/Path/To/Directory" to the pathname of the target directory, e.g. "/Volumes/Name/Directory/.."
  • Move Finder Items to Trash

  • Save the workflow as an application.
    • Test that this does as you want before saving it as an application.

Note: You could devise a more complex find command and or workflow, however this, as is, is better then your current malfunctioning workflow.

You must log in to answer this question.

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