opkgplus.blogg.se

Windows zip
Windows zip





windows zip

For installing Windows on my Linux machine I needed to unzip this file to a usb file using Linux, but Linux refused to do so due to invalid paths.

windows zip

I had downloaded a Windows driver containing paths with a backslash ("") as path separator. # the pass already exists and is a folder, let's just ignore it If exc.errno = errno.EEXIST and os.path.isdir(full_dir_name): This is just an update of answer which includes fixes by ( FileExistsError: File exists and missing os module import), a fix for python 3 ( Synta圎rror: Missing parentheses in call to 'print') and a fix for the missing errno module import ( NameError: name 'errno' is not defined). Given the problem that you describe, the unzip_dir probably doesn't have any subdirectories to start with, and the program could just walk over the files in the current directory only. This handles files in any directory under the directory from where the program is started.

windows zip

Os.makedirs(full_dir_name) # only create if not done yet # never creates a directory if there is a parent dir with a file.įor root, dir_names, file_names in os.walk('.'):Īlt_file_name = file_name.replace('\\', '/')Īlt_file_name = alt_file_name # cut of starting dir separatorĪlt_dir_name, alt_base_name = alt_file_name.rsplit('/', 1)įull_dir_name = os.path.join(root, alt_dir_name) # already created directories, walk works topdown, so a child dir Updating: pip/ (244 bytes security) (stored 0%)Īdding: pip/pip.log (164 bytes security) (deflated 66%)īut now that you have the files with file names that contain "paths" with backslashes, you can run the following program in unzip_dir: #! /usr/bin/env python I think something went wrong with the creation of the zip file, because when I create a zip file on Windows is has (portable) forward slashes: zip.exe -r pip pip







Windows zip