Last active
July 29, 2016 22:04
-
-
Save oelna/9547cf255a1012bd5c59 to your computer and use it in GitHub Desktop.
An Automator service that creates a .tar from files and folders selected in the Finder
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
#thanks to Gordon Davisson on SO: http://stackoverflow.com/a/35146562/3625228 | |
files=() | |
for f in "$@" | |
do | |
path=`dirname "$f"` | |
file=`basename "$f"` | |
files+=(-C "$path" "$file") | |
done | |
tar -cf ~/Desktop/archive.tar "${files[@]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For some reason, the .tar's created are double the size of the originating folder. Any ideas on how to resolve this? I tried taking the loop out and just tar'ing individual folders, but it still double in size with tar'd. Un-tar'd it goes back to same size. Same result on folders with very few large files. 7 GB turned into 14GB.
files=()
path=''
for f in "$@"
do
path=
dirname "$f"
file=
basename "$f"
done
tar -vc --exclude '02_Footage' -f ~/Desktop/"$file"_CON.tar "${files[@]}"