Tuesday, May 13, 2008

7-Zip, drag and drop and the temp-dir mystery

Today I downloaded the Eclipse Ganymede M6 Java EE package. It is a 178MB ZIP archive containing the IDE. Downloading took a few minutes and then I was ready to go. Well, almost. Of course the ZIP needed to be extracted first. I use 7-Zip as the archive tool of choice. It has proven to be reliable and fast.

However it shares one "habit" I have seen so far with every archive tool I tried: Wherever you want to extract the contents of the archive, it will first put all files into the %temp% directory - often on the system partition - and only then copy the unpacked content to the final location.

With the Ganymede package this means 217MB of data in 4180 files and folders are first read from the archive and stored in a folder. On my P4@3GHz this takes about 110s. After that a copy of that some data - almost 4200 files - takes another 90s. Apart from that, instead of 217MB I now need twice as much almost half a gigabyte to store both the temp copy and the final one. Why is that necessary?

There are some threads on the 7-Zip forum also discussing this. Apparently (however I could not find it in the linked MSDN articles) this has to do with how Windows handles drag and drop. And indeed, extracting via the "two-folder mode" (F9 in 7-Zip, I did not know that before) puts the archive contents directly to the destination, saving almost half the time.

If anyone more knowledgeable in Windows development could shed some light on this, I would surely be grateful. For now, knowing the workaround is fine, too.

Just one more thing: When I first hit F9 in a 7-Zip window apparently nothing happened. Turns out the split control was all the way to the left, almost invisible next to the window border, so if you don't see a second pane come up, have a close look there :)

17 comments:

Dolph said...

Nice tip! Thanks!

I stumbeled over this before in 7zip and winrar has the same nasty problem. Especially annoying if your C-partition is running out of space...

Anonymous said...

It seems to be a standard Windows issue across many pieces of software. WinSCP and Filezilla overcome it by installing their own custom Drag'N'Drop DLL:

http://winscp.net/eng/docs/dragext
http://wiki.filezilla-project.org/FileZilla_FTP_Client#FileZilla_3.0.0-beta6_.282007-02-19.29

Anonymous said...

I had a 35GB 7zip file I could not extract until finding this F9 trick. Thank you!

Anonymous said...

Using a netbook with only 4gb as the os disk this has solved quite some problems for me, thanks a bunch!

Anonymous said...

Thank you so much.... I was looking for this, it was pretty annoying waiting the file to be extracted and then waiting the copy from temp to destination folder (big files).
Great

Anonymous said...

It is the standard Windows' model for drag and drop; the only workaround is to let the program handle whole process, but it hits the big "how": how to get the drop destination.

7-Zip http://www.7-zip.org/ resolves the problem to the root with two panel view: the drop event is still in 7-Zip's control and the application knows were to put the data.
The obvious drawback is that from user's p.o.w. it is different than dropping the files around in another system's window, as it is usual for file move/copy.

PeaZip's http://peazip.sourceforge.net/ instead resolves the problem in another, interesting, way, querying the system for the handle of the active window under the mouse position, that allows to get the drop destination and also to emulate more naturally the user's drag and drop habits, but without using the insane Windows' drag and drop model!

Anonymous said...

Thanks for this nice tip, I've wondered for some time how to skip this shit with the temp folder!

Justin Deltener said...

I've been having major trouble extracting large files and not having enough room on C: for the temp space. I would never of thought to use 2 panel. Thanks for the tip; gotta love simple!

Anonymous said...

"under options plugins tab press 7-zip options folders tab change the working folder" source: http://forums.anandtech.com/showthread.php?t=186401

Marco Göbenich said...

The last tip solved that problem for me.

Anonymous said...

THANKS! F9 did the trick, worked like a charm.
Changing the folder settings in the plugin did not help.

Anonymous said...

GREAT!! Thnks, this is one big problem solved at last!!

Anonymous said...

i know it's almost a necropost, and though i searched for someting other i happen to find your tip with F9 = that's great! thank you so much for sharing it)

Anonymous said...

After God only knows how much time spent failing to uncompress all sort of files cause the partition where the temp dir was ran out of space FINALLY I found a solution.
THANKS for sharing.

Malzbier said...

Thanks a lot for this post. Probably never figured that out on my own.

Anonymous said...

The big thing that bugs me is that, while you can't eliminate the problem completely, 7-zip could fix it by moving the file rather than copying it. Yes, that means it can't use the default TEMP file methods, but it shouldn't be using those anyways since it allows you to set your own working folder.

So just always extract to the working folder, then tell Explorer to MOVE the file. That's how it works in every other program.

Anonymous said...

You guy can also click the extract button and then specified where you want the file as will, but if you like to drag and drop then you can use the f9 function :).