Automator workflow to TAR multiple files in a single directory into multiple TAR archives, in succession?

Good afternoon,


I have set up an automator service that TAR's a folder into an archive for me and it works quite nicely. Idealy however, I would like to be able to highlight several folders, right click and have automator tar each folder into it's own TAR archive, but do it one by one.


Example:


FOLDER 01

FOLDER 02

FOLDER 03


Highlight all - Right Click - "TAR Folder" - Automator takes over at this point and TARs each one into:


FOLDER 01.tar (Once complete moves onto:)

FOLDER 02.tar (Once complete moves onto:)

FOLDER 03.tar (Finished)


I'm not 100% sure so I guess it would be a good time to verify, is there a problem with having the system try to TAR multiple folders at one time? If it is not a problem then I guess this discussion itself is pointless and I can simple right click on each folder and select "TAR Folder" and just wait until they're all finished. I would think that it would be ideal for the system to do each one individually and not try to do them all at one time.


Any help would be appreciated.


Thank you!!

Posted on Jun 12, 2012 11:30 AM

Reply
4 replies

Jun 12, 2012 12:39 PM in response to mloucks83

Aren't you using Automator's "Run Shell Script" with "pass input as arguments"? It produces a skeleton that looks like:


for f in "$@"

do

echo "$f"

done


So you can select multiple folders or files in the finder and have it operate on each object one by one (in place of the echo).


I do a similar thing when I create automator scripts as a Service not Workflow. Then I can select multiple items in the finder and have my script operate on them one by one via the finder's contextual menu.

Jun 12, 2012 3:17 PM in response to mloucks83

I don't think I have the following totally fleshed out but you probably can extrapolate on it. This is a service which you can right click a set of folders and it will tar the files within those selected folders with then file names "name xxx.tar", where name is the tar'ed file/folder and xxx is a count within the folder.


I think that is what you originally specified so I am a bit confused by your script with the bit about Archive.tar.


Anyway here the basic idea:


User uploaded file


I ran the script directly with a folder argument just to see it indeed tar's up all the stuff inside, one tar per item.

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.

Automator workflow to TAR multiple files in a single directory into multiple TAR archives, in succession?

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