Curtainferno: If there's anyone on Linux here who wants a way to fix IndieGala's improperly-made ZIP files, I came up with an effective-but-slightly-cumbersome approach here:
https://forums.indiegala.com/threads/bad-zip-games-archives.14694/post-106906 And if there are any Linux shell scripting wizards here willing to help out, I would love to get a response to the question I ask in that post! ^^
Shells are weird. When testing on a command line by hand, and it works there, you cannot always put this exact code into a script. My suspicion is (untested) that yours is suffering from an "escape effect".
I've just written the following which works under the Debian Almquist Shell "dash" as "/bin/sh":
----8<----------------------------------------
#Shellscript: winBSunzip.sh
----8<----------------------------------------
#!/bin/sh
# 0.0.0.1 29.3.2025 Entpackt ZIP-Dateien mit \ anstatt / 1. Testversion
# 0.0.1.0 29.3.2025 unzip -d … cd
# 0.0.1.1 29.3.2025 echo sed
# 0.0.1.2 29.3.2025 TEST echo
# 0.0.1.3 29.3.2025 TEST echo \\
# 0.0.2.0 29.3.2025 echo \\
# 0.0.3.0 29.3.2025 sed
# 1.0.0.0 29.3.2025
VER="1.0.0.1"
ZIP="$1"
if [ -f "$ZIP" ]
then
DIR=`basename "$ZIP" .zip`
if [ -d "$DIR" ]
then
echo "Stopping: $DIR already exists in the current folder!"
else
mkdir "$DIR"
unzip "$ZIP" -d "$DIR"
cd "$DIR"
for FN in *\\*
do
NEWNAME=`echo "$FN"|sed -e 's/\\\/\\//g'`
NEWPATH=`dirname "$NEWNAME"`
NEWFILE=`basename "$NEWNAME"`
mkdir -p "$NEWPATH"
mv -v "$FN" "$NEWPATH/$NEWFILE"
done
fi
else
echo "No file $ZIP"
echo "Usage: $0 PATH/TO/ZIPFILE"
fi
----8<----------------------------------------
As you can see above in the changelog, I've tested 8 "iterations" until it worked properly, the key being
the command:
sed -e 's/\\\/\\//g' Despite of single quotes around the command
s/SEARCH_STRING/REPLACEMENT/g,
a
double backslash is needed to escape the \ we are searching for, as well as the replacement /.
Likewise, "
for FN in *\\*" MUST have \\ inside the script, as opposed to \ when typed interactively.
The above script should do generally the same as the "igunzip" posted on Indiegala.
It extracts everything into a newly created folder in the current directory named after the ZIP file (minus the extension, if it is .zip), provided this name does not exist yet.
Then it goes into this directory and calculates a new name with forward slashes instead of backslashes for each file containing at least one backslash in its name.
This new name is separated into a directory path, which is created, and the original file name.
After that, the file with the backslash name is moved into the folder and renamed while doing so.
Double quotes are used around name variables to preserve spaces in file names. There might exist weird cases where my script fails, however.
Permissions and timestamps are preserved, but for files only, directories are created on behalf of the calling user, and will have current timestamps according to Unix rules.