What order are zip files extracted in? - zip

Q: How do extraction programs work? How do they choose which files to extract first?
I extracted a zip file from Google Drive using an online extension. I was a bit surprised when the files came out to a mostly alphabetical order. I downloaded the files in an alphabetical order. So I tried to extract the files again locally from my computer. And again they came out to a mostly alphabetical, but different order. Why is that?

Related

Compare files to files inside a Zip archive

I have a zip file which I extract to a folder. I then need to open the files and perform various functions but the files are not modified or saved at all.
I use Dotnetzip to extract the files from the archive before the files are opened and viewed etc.
Is there a way to compare the files, which was extracted, to the files still inside the zip file without extracting those files again? The zip files I have is quite large. Some of them several 100 Mb's so don't want to wait for another extraction process again.
Thanks!

os.symlink and window's .lnk files are different

I am processing a big images dataset and I'm trying to reorder the files in classes, while at the same time keeping the original directory structure.
To do this, I make a second directory structure with symlinks to the files in the first one.
Everything works as it should but for one small detail: the symlinks created via os.symlink() do not show the image thumbnail, while if I make a link of the same file (e.g., via right click & send to Desktop) I do see the thumbnail.
I wanted to check how the two link files differ (note, the link files themselves, not the linked file), but if I try to drag the os.symlink-generated file in a text editor it opens the linked file instead (while this does not happen with the .lnk file generated via right-click).
What's the difference between the link files? Is os.symlink making something different than a .lnk file? If so, is there a way to get the thumbnail? And if there's no such way, how can I make a .lnk file instead?

Importing list of files to compress/zip

Does anybody know of any way (on Windows) to create an archive (zip, rar,..) and adding files to it by importing a list of files to be added (say from a CSV or text file or simply pasted) that need to be archived. Say I have a simple list of 1,000 files across multiple directories that I want to add to an archive, this would be a much simpler method of doing it than adding each file individually. Also I do not want to arhive the entire directory as it is absolutely massive.
eg:
c:\somedir\file1.php
c:\somedir\somesubdir\file2.php
c:\someotherdir\file3.php
...
And no I do not want to import all files in certain directories, the hundreds of files are scattered across tens of directories which also contain lots of other files that I do not want to archive.
Thanks
rar.exe from WinRAR has the following option:
n#<list> Include files listed in specified list file

Zip file with .csv extention lost somewhere in filesystem

The file is also locked with winzip and I cant remember the name or directory, I hid it in a very obscure directory. Could be in the windows system files could be in a program directory file. I did a search for all .CSV files I have 4-5K to go through. Any suggestions on how this could be done?
I was opening up files in batches by highlighting a bunch that pressing edit with notepad plus plus. Than going through each one. I know once the file is opened in notepad plus it will not show any words. It is pictures. I own an eCommerce site and I have my master copies that I bought $X,XXX and did not want to take any chances in them be found and resold by other people on my network. Any suggestions?
Opening any zip file in a hex editor suggests that every zip file starts with a data of PK. We can use it in our favour. :)
Download this software: EditPad Pro
What this software does is, it recurses through the whole filesystem starting from a specified base folder to search for any string residing in any of the child files, they maybe Text or Binary, it treats them the same, thus giving accurate results.
In our case, it's a regex: ^PK
When you'll execute this search, the software will return all the files that start with data PK, make sure you do a casesensitive search.

How can I specify the version of zip to use in bash?

Background (not necessary to read)
I'm tinkering with MS office files for work (trying to figure out the quickest, easiest way to automate generation of arbitrary-length excel and powerpoint files). Since actual excel files are just zipped archives with .xlsx appended to the filename, I've been unzipping them, editing the xml, rezipping them, and seeing whether OpenOffice can still load them.
However, I've realized (after not too much such testing, thankfully) that, by default, the 'zip' command in bash (or, at least, on my mac) is zipping the files in a format that only requires unzip v1.0 to extract, but normal excel files are zipped in such a way that they require v2.0 to extract. I checked this is a problem by zipping and unzipping an excel file that I knew loaded normally, and then trying to load it. OpenOffice was displeased.
So, I know I need to make the file zip exactly the way excel does, but how to make that happen I'm not sure. I have zip version 3 on my computer, so hopefully if the zip/unzip release cycles are synchronized it should be possible, but I didn't see anything on the man page that immediately seemed to be the solution.
edit:
And zip -9 (which zip -h helpfully says instructs zip to 'zip better') still only requires v1.0 to extract.
Question:
How can I specify in bash that I want zip to zip a file in such a way that it would require unzip v2.0 to unzip?
Often, the reason for an incompatibility between compressed files produced by different versions is the compression algorithm used. If the files were compressed with an algorithm that didn't exist in zip 1.0, that would cause the incompatibility you're seeing.
Look at the man page for your zip utility, see if there's an option to specify the type of compression to use. If there is, look at the existing files created from Excel, and find out what type of compression algorithm they're compressed with, and use that.
On my Linux system, zip reports "This is Zip 2.31 (March 8th 2005), by Info-ZIP.", and it does not have an option for specifying the compression algorithm. On my Windows system, 7-zip does have the option, and it looks like they do have a Mac version available, so you could try that if your zip utility doesn't support that option.

Resources