Rar archive in mac finder with automator


用Mac的一个重要麻烦就是zip archive经常在windows下乱码,由于mac采用unicode编码,中文文件名zip压缩文件之后,在采用ansi编码格式的windows上就是乱码,往往无法解压还原。用stuffit,finder自带的压缩,都避免不了这个问题。

但rar文件就没有乱码问题,用betterzip之类的就可以归档rar文件,但大多需要打开betterzip程序,再选择文件等,多了好几个步骤,如何能在finder里选择目标文件直接生成rar文件?当然可以,用mac著名的automator!

在automator里,选择Service服务类型,选择接受文件和目录,然后拖进执行shell脚本,选择输入自变量,然后在脚本内容里输入:

#!/bin/bash
for f in “$@”
do
pp=`dirname “$f”`
ff=`basename “$f”`
cd “$pp”
/usr/local/bin/rar a -m5 -ep1 -o+ Archive.rar “$ff”
done

保存为建立rar的工作流服务,这样在finder选择多个文件或目录后,右键选择服务里直接可以把目标文件生成rar归档文件了。

,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

This site uses Akismet to reduce spam. Learn how your comment data is processed.