0

I am building a program to delete files/folders. Here is how my program looks in Automator:

enter image description here

The problem I am having is sometimes where the program runs I get this error:

enter image description here

The program does work so I don't know why this error is popping up. Is there an Automator or AppleScript command that I can use to bypass this error so it does not show up at all?

enter image description here

This is the AppleScript:

delay 5
tell application "Finder"
    try
        delete (every item of folder "TV Show Downloads" of disk "Drobo" whose modification date is less than ((get current date) - 1 * days))
    end try
end tell
1

I suspect you may be getting this error because you are trashing folders and files in the same action. In other words, if automator tossed out a folder containing a '.mov' file, it will toss out the '.mov' file as well; then (later) when automator tries to toss that '.mov' file, it cannot find it, because it's already in the trash.

First solution to try: move the kind is folder option to the bottom of the list, in the hopes it sorts folders last.

If that doesn't work, then you may need to complexify your workflow with a variable, like so: enter image description here

| improve this answer | |
0

A common Automator error is to just get items, forgetting to remove an action added for testing, or that an application or service can already have items passed to the workflow. This can result in extra or duplicate input items - for example a Filter Finder Items action will apply the filters to the current workflow items, while a Find Finder Items will apply the filters to items from the specified source, adding them to the workflow items.

Your error is most likely from doubling up some of the file references. The application will already get items passed to it automatically (the items dropped onto it), and those are being added to the items returned from the Find Finder Items action, resulting in the workflow trying to trash items that have already been moved to the trash.

Automator doesn't have any control or conditional actions, so if you are running an application without the intention of dropping items onto it, each action has an Ignore Input option that will prevent the usage of any items passed to it. By using this option on the initial Find Finder Items action, you won't have to worry about anything extra being added from dropping items onto the application.

If what you are wanting to do is make sure you haven't accidentally grouped something in with the items you are wanting to trash, using the Filter Finder Items action instead of Find Finder Items will perform the filters on the items passed to the workflow without getting any others.

| improve this answer | |
  • In Automator below "Find Finder Items" if I add "Filter Finder Items" below that will that get rid of the error? – iNickster Jan 11 at 3:41
  • Replace the Find Finder Items action with Filter Finder Items - the find action adds more items to the workflow. I've clarified my answer. – red_menace Jan 11 at 4:11
  • I have done what you said to do and now when I run the app it doesn't do anything. Any suggestions? – iNickster Jan 11 at 4:39
  • The filter action would apply the specified filters to items dropped onto the application. – red_menace Jan 11 at 4:42
  • I have added a picture to my question of what I have now in automator. Is it correct? – iNickster Jan 11 at 4:49

You must log in to answer this question.

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