create an automator quick action to enable creation of tar archives using tar command on macOS

I want to create an automator quick action to enable creation of tar archives using tar command on macOS on any selected file or folder in finder. Do I have to use Apple Script or something else?

I am unable to do it. Someone please help.

Posted on Aug 21, 2022 6:51 AM

Reply
1 reply

Aug 21, 2022 7:08 AM in response to sn72

I am unable to run the script below in Automator:


Tarfile="$1.tar"
count=1
cd "${@%/*}"if [ $# -eq 1 ]; thenwhile [ -e "$Tarfile" ]
  dolet count++
    Tarfile="$1 $count.tar"doneelse 
  Tarfile="Archive.tar"while [ -e "$Tarfile" ]
  dolet count++
    Tarfile="Archive $count.tar"donefi
/usr/bin/tar -chf "$Tarfile" "${@##*/}"


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.

create an automator quick action to enable creation of tar archives using tar command on macOS

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