Create an automator quick action to enable creation of tar archives using tar command on macOS on any selected file or folder in finder


Joined
Aug 21, 2022
Messages
1
Reaction score
0
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 Shell Script or something else? I am unable to do it. Someone please help.
I am unable to run the following script for creating tar files. Getting error message.

Tarfile="$1.tar"
count=1
cd "${@%/*}"
if [ $# -eq 1 ]; then
while [ -e "$Tarfile" ]
do
let count++
Tarfile="$1 $count.tar"
done
else
Tarfile="Archive.tar"
while [ -e "$Tarfile" ]
do
let count++
Tarfile="Archive $count.tar"
done
fi
/usr/bin/tar -chf "$Tarfile" "${@##*/}"
 
Ad

Advertisements

Cory Cooper

Moderator
Joined
May 19, 2004
Messages
10,749
Reaction score
464
Hello and welcome.

I don't have much experience with AppleScript/Automator. Maybe another member will chime in, or you can try the folks over at MacScripter.

C
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top