Skip to content

Instantly share code, notes, and snippets.

@nmandery
Created April 7, 2011 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmandery/907876 to your computer and use it in GitHub Desktop.
Save nmandery/907876 to your computer and use it in GitHub Desktop.
pack directories to odf files
#!/bin/sh
set -e
TSTAMP=$(date +%Y%m%d-%H%M%S)
INDIR="$1"
OUTFILE_BASE=$(echo "$INDIR" | sed 's/-unpacked//g' | sed 's/.odt//g')
OUTFILE="$OUTFILE_BASE.odt"
[ -d $INDIR ] || exit 1
[ -e $OUTFILE ] && mv "$OUTFILE" "$OUTFILE.$TSTAMP"
CDIR=$(dirname $0)
cd "$INDIR"
zip -r "../$OUTFILE" .
cd "$CDIR"
echo "created $OUTFILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment