Created
November 14, 2011 06:33
-
-
Save nacho4d/1363389 to your computer and use it in GitHub Desktop.
[Shell] Zips a file - To be used with Automator to create a short cut for the task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
INFILE=$1 | |
ZIP=".zip" | |
OUTFILE=$INFILE$ZIP | |
if [ -f "$INFILE" ]; then | |
echo "Compressing file: $INFILE" | |
COUNTER=0 | |
while [ -f $OUTFILE ]; | |
do | |
COUNTER=$((COUNTER+1)) | |
OUTFILE="$INFILE$COUNTER$ZIP" | |
#echo "calculating... $OUTFILE" | |
done | |
echo "Output path: $OUTFILE" | |
zip $OUTFILE $INFILE | |
exit 0 | |
else | |
echo "No file at path: $INFILE" | |
exit -1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment