Last active
May 1, 2021 18:05
-
-
Save limitedeternity/fa54878894ac4be05ea48f52c57532d3 to your computer and use it in GitHub Desktop.
Fix zip archives created on Windows to work on Linux
This file contains hidden or 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
# "archive.zip" should extract to "archive" folder | |
7z x archive.zip | |
# But shit happens. And now we are going to fix it: | |
: " | |
Before: | |
-- archive\log.txt | |
-- archive\renpy\ast.py | |
After: | |
-- archive | |
|_____-- log.txt | |
|_____-- renpy | |
|__________-- ast.py | |
" | |
for file in *\\*; do target="${file//\\//}"; mkdir -p "${target%/*}"; mv -v "$file" "$target"; done | |
# In case you need to make every file in "archive" folder executable: | |
find archive/ -type f | xargs -n 1 chmod +x -v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment