How can I batch archive a folder list in Automator?

hello --


in principle it should be rather easy, but i think i am missing something. all i want to do is this:


1.) Get Selected Finder Items

2.) foreach Folder create archive with same name and same location


i can't find a way to tell automator to use each selected folder instead of all of them as input for the create archive function. any suggestions how i can do that would be much appreciated.


thank you in advance.


p.

Posted on Nov 16, 2012 11:18 AM

Reply
9 replies

Nov 17, 2012 10:16 AM in response to Patrick J

Hi,


Patrick J wrote:


i assume this means there is no direct way without applescript to loop through a list of folders in automator?


You can use this solution:


- Keep The first action, remove all other actions.

- Add the "Run Shell Script" action.

- In this action :

- Select "/bin/bash" in the first popup, select "as arguments" in the second popup.

- Cut all text.

- Copy/paste this text :


for f in "$@"
do
    /usr/bin/ditto -c -k --sequesterRsrc "$f" "$f.zip"
    echo "$f.zip" ## return the path of each archive to the next action
done

Nov 19, 2012 4:56 AM in response to Patrick J

I'm pleased that Jacques's solution works because, upon further testing, I see that mine doesn't. I was using a very simple test case: two folders on the Desktop.


By the way, I had the Loop action set to Ask to continue. I see now that setting it to Loop automatically/Stop after 0 minutes will cause only the first item to be processed. Keeping Loop automatically and inserting a Pause action (at 2 secs) didn't help--the workflow still processes only the first item. Weird.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How can I batch archive a folder list in Automator?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.