Last active
April 27, 2022 17:13
-
-
Save IOIO72/2e632b0c56518f124389e406e46320cb to your computer and use it in GitHub Desktop.
WHDLoad ZIP to LHA conversion (The A500 mini)
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
find . -maxdepth 1 -name '*.zip' -exec mvexistsuffix {} zip lha \; |
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
#!/bin/sh | |
if ([ -z $1 ] || [ -z $2 ] || [ -z $3 ]) | |
then | |
echo "Usage: mvexistsuffix <filename> <suffix1> <suffix2>" | |
echo "Example: mvexistsuffix archive.lzh zip lha" | |
exit 1 | |
fi | |
if [ ! -d $2 ] | |
then | |
mkdir $2 | |
fi | |
if [ ! -d $3 ] | |
then | |
mkdir $3 | |
fi | |
BASE=${1%.*} | |
FILENAME_A=${BASE}.$2 | |
FILENAME_B=${BASE}.$3 | |
printf "$BASE" | |
if ([ -f $FILENAME_A ] && [ -f $FILENAME_B ]) | |
then | |
echo " -------> $2 $3" | |
mv $FILENAME_A $2 | |
mv $FILENAME_B $3 | |
else | |
echo "" | |
fi | |
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
#!/bin/sh | |
# $VER: ZIP2LHA v1.0.0 by TCH | |
command -v unzip >/dev/null 2>/dev/null || { echo >&2 "Please install unzip."; exit 1; } | |
command -v lha >/dev/null 2>/dev/null || { echo >&2 "Please install lha."; exit 1; } | |
if [ -z $1 ] | |
then | |
echo "Usage: zip2lha <zipfile>" | |
exit 0 | |
fi | |
if [ ! -e $1 ] | |
then | |
echo "File does not exists." | |
exit 1 | |
fi | |
FNF=${1##*/} | |
FN=${FNF%.zip} | |
DN=${FN}_tmp | |
printf "$FN..." | |
unzip $1 -d $DN >/dev/null 2>/dev/null | |
if [ ! -d $DN ] | |
then | |
echo "Failed to extract ZIP archive." | |
exit 1 | |
fi | |
cd $DN | |
lha -a ../$FN.lha * >/dev/null 2>/dev/null | |
cd .. | |
rm -r $DN | |
echo "ok" |
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
#!/bin/sh | |
find . -maxdepth 1 -name '*.zip' -exec zip2lha {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lha
(i.e.brew install lha
)chmod +x
{script}/usr/local/bin/
zip
and correspondinglha
archives for the same games, executefinished2folders.sh
zip2lha-all.sh
to convert allzip
archives of the current folder tolha
finished2folders.sh
to move all correspondingzip
andlha
archives to subfolders.