Invalid File Name Inside Zip File

Invalid File Name Inside Zip File

I have a ZIP file, and inside that zip file, there's multiple files with invalid file names (for my Debian OS): for example fileABC£ [abc123].txt

When I attempt to extract it unzip data.zip:

error:  cannot create data/subfolder/fileABC� [abc123].txt
        Invalid argument

How do I successfully unzip this file?

1

1 Answer

I was able to fix the problem by using a python script:


#Python 2.x

import zipfile

print "[*] Beginning extraction process..."

zip = zipfile.ZipFile('data.zip')
for i, f in enumerate(zip.filelist):
  f.filename = 'extracted_{0:03}'.format(i)
  zip.extract(f)
  print "--- Extracted '%s'" % (f.filename)

print "[*] Done"

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.