Skip to content

Instantly share code, notes, and snippets.

@sxiii
Created December 6, 2021 20:16
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 sxiii/f3e187707fdf0639aae7898623101bb0 to your computer and use it in GitHub Desktop.
Save sxiii/f3e187707fdf0639aae7898623101bb0 to your computer and use it in GitHub Desktop.
Convert ZIP with Windows filepaths to Linux (/ instead of \)
# Convert ZIP archive with Windows paths inside it to UNIX paths (backslashes \ to normal slashes / in paths)
# You need 7zip package for that matter
# Archive in this example is called windows.zip -> don't forget to change it in two places
# The script works well even with large files (I tested on 8 GB file; it took couple of seconds)
# Resuling file can be unpacked OK with normal Linux tools
7z rn windows.zip $(7z l windows.zip | grep '\\' | awk '{ print $6, gensub(/\\/, "/", "g", $6); }' | paste -s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment