Skip to content

Instantly share code, notes, and snippets.

@kambara
Created April 30, 2011 13:25
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 kambara/949661 to your computer and use it in GitHub Desktop.
Save kambara/949661 to your computer and use it in GitHub Desktop.
指定したディレクトリの中にあるディレクトリをそれぞれzip圧縮
#!/bin/sh
cd $1
ls -F | grep / |
while read dirname
do
dirname=`echo "$dirname" | sed -e 's/\///'`
if [ -d tmp ]; then
rm -rf tmp/*
else
mkdir tmp
fi
cp -r "${dirname}"/* tmp/
rm tmp/Thumbs.db
convmv -r -f utf8 -t sjis --notest tmp/
cd tmp
zip -r ../"${dirname}".zip *
cd ..
rm -rf tmp
done
@kambara
Copy link
Author

kambara commented Apr 30, 2011

Windowsで文字化けしないようにファイル名の文字コードをSJISに変換している。
convmvとzipコマンドが必要。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment