I am trying to create an automator based workflow whereby I create archives of folders but exclude certain files from the final archive. I would also like to specify the files or folders to exclude (e.g. ".cvs" or ".git" or ".psd" etc).

Here's how I have currently tried to do it, but cannot get step2 below working:

  1. I specify a folder to scan and archive.
  2. Automator/script recursively filters out certain files which I can specify (e.g. ".cvs" or ".git")
  3. Automator creates an archive of the remaining files from step2.

Im certain there must be an easy way of achieving this with automator - any assistance would be appreciated.

  • Are you ok calling a script in Automator (or just doing this through a script)?
    – jmlumpkin
    Commented Apr 8, 2011 at 21:52

2 Answers 2


Automator won't be enough to do this.

You'll have to devise an applescript (or some other kind of script) to do the filtering, since the automator action "Filter Folder Items" will not work recursively. Any folder will not have the undesired extensions so will be added, even if the folder contains files with those extensions.

  • I kinda think this should be a comment since it doesn't give a functioning answer. It is good info, just not a full answer IMO. Commented Apr 8, 2011 at 18:58
  • Oh well. I wish I had known this before spending so much time trying to do this. I will leave the question open for a while, in case there's people out there that do know of a way. If there isn't any solution then I guess @ghoppe is right and I will select this as the corrent answer. hope
    – mozami
    Commented Apr 8, 2011 at 20:01
  • 1
    You can execute shell scripts or AppleScripts from Automator. So, don't abandon Automator altogether. You'll need to supplement the drag-and-drop stuff, but you can do it all from an Automator workflow. Commented Apr 9, 2011 at 1:29
  • 1
    Yep, Nathan's right. If you're using Automator for your workflow, you can still use it to run another script to do what you want. When I said it won't be "enough" I didn't mean you'd have to abandon it.
    – ghoppe
    Commented Apr 9, 2011 at 18:18

I like to version control my apps but do not want the non app files to be part of the app, especially when using 'diskutil' to make a dmg distro file for my app. I found the 'rsync' utility useful as an alternative to the 'cp' command as that supports the --exclude option to exclude files that should not be part of the clean app as follows

mkdir myapp
rsync --exclude '.cvs' --exclude 'CVS' --exclude '.git' -av /path/to/myapp.app  myapp
  • 1
    Your answer could be improved by explaining why your answer is correct. This helps people to learn and grow.
    – agarza
    Commented Apr 16, 2022 at 13:08

You must log in to answer this question.

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