Skip to content

Instantly share code, notes, and snippets.

@y-yoshinoya
Created October 1, 2012 07:24
Show Gist options
  • Save y-yoshinoya/3810091 to your computer and use it in GitHub Desktop.
Save y-yoshinoya/3810091 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Create zip archive within multibyte-named files for Windows PC.
# (utf-8 -> sjis)
#
# Dependencies:
# sudo apt-get install zip convmv
if [ $# -lt 2 ]; then
echo "usage: $0 zipfile files" 1>&2
exit 0
fi
ZIPFILE=$1
shift
FILES=$*
DIR=/tmp/zip.$$
mkdir $DIR
cp -r $FILES $DIR
cd $DIR
convmv -f utf-8 -t sjis * --notest
zip $ZIPFILE *
zipcloak $ZIPFILE
cd -
mv $DIR/$ZIPFILE .
rm -rf $DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment