2

I just started using Automator for the first time. My folder action gets two Finder items: say 'foobar1.pdf' and 'foobar2.pdf' files, and copies them to another folder.

It works but there is a side-effect: also the auxiliary files with the same name but different filename extensions (.aux .nav .snm .toc and .out) were also copied.

To solve that I created another folder action to send 'foobar1.aux', 'foobar1.nav' and so on to the Trash. But to test it, I did not add 'foobar2.aux', 'foobar2.nav' and so on. The new script works—the files are send to the Trash but now there is a beneficial side-affect: the auxilary files for 'foobar2' are also deleted even if they were not included in the workflow.

Is there a logical explanation for this behavior? Any way to avoid the side-effects?

copying files

cleaning the folder

  • Can you share a screen shot of your Automator set up. – Ruskes Sep 12 '14 at 17:13
  • @Buscar웃 Will do. Just a second have to figure out how to do this. – Sergio Parreiras Sep 12 '14 at 17:15
2

A Folder Action workflow will give you every file when a change is detected in the specified folder, including ones you are not interested in.

Your problem is with Get Specified Finder Items. It just adds items to the list of files to process. It doesn't filter anything!

Use the Filter Finder Items action instead to filter the list returned by Finder. You can do it any number of fields/options including name, extension and type.

Filter Finder Items Action

  • Thanks! It worked! Perhaps you could help with a related minor question also? When I modify the files in the source folder - for the workflow above to work, I have to delete the old versions before saving the new versions. If I simply save the new files over the old ones, nothing happens. Anyway to trigger a change in the specified folder just saving by the new files? – Sergio Parreiras Sep 12 '14 at 20:20
  • 1
    According to Automator's own help documentation, a Folder Action is to be used to detect new files in a folder. So it doesn't appear to support detection of changes. :( Having said that, you can apparently use launchd to detect files changes and there are other ways as well... – Vic Sep 12 '14 at 20:34
  • Thanks again! Also another alternative would be an script with rsync but I sill have to figure out how it works. :-) – Sergio Parreiras Sep 12 '14 at 20:42

You must log in to answer this question.

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