Skip to content

Instantly share code, notes, and snippets.

@FreeSlave
Created September 4, 2016 09:09
Show Gist options
  • Save FreeSlave/2a715628b26a8000a83034000f928c17 to your computer and use it in GitHub Desktop.
Save FreeSlave/2a715628b26a8000a83034000f928c17 to your computer and use it in GitHub Desktop.
Unpack zip archive and convert filenames to utf-8 (e.g. if you got zip archive from Windows)
#! /bin/bash
from=
to=
if [ -z "$1" ]
then
echo "Error: no arguments"
exit 0
else
from="$1"
fi
if [ -z "$2" ]
then
to=${from%[.]zip}
else
to="$2"
fi
unzip "$from" -d "$to"
cd "$to"
convmv -r -f cp1252 -t cp850 * --notest && convmv -r -f cp866 -t utf-8 * --notest
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment