Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Tips to expand zip archives with long filenames Install
This hint started as a tip from avanham, who wrote:
I downloaded the Java SDK 1.3.1 API documentation from java.sun.com and had always thought that some of the pages were missing because some of the links did not work. Recently, I discovered that they were, in fact, in the archive but that their names had been chopped short. This only happened with the long names like:

DefaultStyledDocument.AttributeUndoableEdit.html

which ended up being something like:

DefaultStyledDocument.AttributeUndoableEdit.ht

The solution to this was to unzip the file into a UFS (BSD) formatted partition. I am not sure what the maximum length of an HFS Extended partition is, but obviously it is not enough.
This problem intrigued me, as both OS X and HFS+ support 255 character filenames, so I wasn't sure why UFS might be required to successfully expand the archive. A bit of experimentation seems to have found the answer.

Read the rest of the article for the results of my experiments with OS X, zip archives, long filenames, and the terminal.

If you'd rather skip the article, the conclusion of the experiment is ... to expand an archive that may have filenames in excess of 31 characters, use the terminal ('unzip') or OpenUp; StuffIt Expander does not appear to handle long filenames successfully, at least based on my research.

As a first step, I downloaded the same SDK documentation and tried to expand it using Stuffit Expander. This resulted in the exact problem described above - truncated filenames for files with long names.

On a hunch, I then opened the Terminal and typed unzip j2sdk-1_3_1-doc2.zip. This worked perfectly -- using the same destination HFS+ disk as the failed Stuffit Expander expansion. So it appears that Stuffit Expander does not support long filenames in archives; this may be common knowledge, but it was news to me (and hasn't been documented here before).

You can test this for yourself by creating a folder with a really long filename (something like "folder with a really really really long name for testing purposes only"), then zip it in the terminal (zip testfile.zip "folder with a really really really long name for testing purposes only").

After the zip archive is created, switch to the Finder and use Stuffit Expander to extract it. You'll find that only the first 31 characters of the folder name are preserved. Now delete this badly named folder, switch to the Terminal, and type unzip testfile.zip. Switch back to the Finder and you'll see your original folder with its full name intact. So if you're having trouble with filenames in an expanded archive, you might wish to try the command line.

Of course, if you don't want to use the Terminal, there's another option available -- download OpenUp for OS X. This Cocoa program expands archives with long filenames successfully from the Finder, and the Terminal is not required (expanded archives are placed in your ~/Library/OpenUp directory.
    •    
  • Currently 2.33 / 5
  You rated: 4 / 5 (3 votes cast)
 
[10,284 views]  

Tips to expand zip archives with long filenames | 8 comments | Create New Account
Click here to return to the 'Tips to expand zip archives with long filenames' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
StuffitExpander and ZIP files.
Authored by: DavidRavenMoon on Apr 06, '02 03:47:44PM

I had a similar problem with Expander once. Now I use Magic Menu (part of StuffitDeluxe) instead. In the Magic Menu prefs there is a setting under the Cross Platform tab that says: "Prefer Unix utilities over Stuffit Engine when possible." This claims to use the OS X command line tools for the creation and decoding of tar, zip, Unix Compress (.Z) GZip, and Unix Encode (.UU) files.

It states this will preserve long file names but destroy any Mac-specific information (i.e. resource forks)

I would have used the Terminal, but didn't know the commands, so this might help others who have StuffitDeluxe installed.



[ Reply to This | # ]
gnutar and .tbz .tgz
Authored by: WillyT on Apr 07, '02 01:24:14AM

If I have ANY trouble with a tarball that Stuffit has touched I put it in my home directory first and gnutar -xzfv tarballname. If this doesn't work (ie its a binary for OS X or it needs installed in root) then I move it to / and sudo gnutar -xzfv tarballname.
Very good for installing man pages that want to go in X11.



[ Reply to This | # ]
api already installed
Authored by: bakaDeshi on Apr 06, '02 04:42:07PM

FYI.

I didn't find this out until after I downloaded the api from sun but it's already installed in os x. Not sure if you have to install the developer tools to get it or not but it's pretty buried.
/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Documentation/api/index.html
It also has com.apple.mrj packages, you can see what apple added.

nothing like spending the time to download something you already have. :]



[ Reply to This | # ]
api already installed
Authored by: jcltech on Nov 14, '02 09:36:45AM

Try looking at /Developer/Documentation/Java/
Sure there are symlinks but that is just about where I would expect my Java docs to land.

There are links there to all Java documentation including a local copy of Sun's, which is in the location previously mentioned, BTW.



[ Reply to This | # ]
um
Authored by: bhines on Apr 06, '02 08:32:44PM

As you said, this article really didn't need to be 4 pages. There's no need to explain how you tested this: EVERYONE knows Stuffit Expander can't handle long filenames. Right? I've posted it ranting about 30 times on csmc.

It's CERTAINLY not a bug in the OS, filesystem, or anything else. I use "OpenUp" for everything except .sit now.



[ Reply to This | # ]
I certainly didn't know...
Authored by: robg on Apr 06, '02 10:34:40PM

After 18+ months with OS X, I had never heard of a filename length limitation with Stuffit Expander. Then again, I don't read csmc (not even sure what it is beyond comp.sys.mac.c-something), and I'm not sure everyone else does, either. Given that Stuffit Expander is the default GUI tool for archive expansion, I felt it merited a detailed look at what was happening and how to work around the problem.

The overriding goal of macosxhints is simply to provide a large database of OS X knowledge for all, with no assumptions about a given user's skill level. Given the objective, I will always opt to include too much information rather than too little. Sorry you found it too obvious and too detailed, but it's possible that the information provided may help someone else down the road, which is why I chose to publish it.

-rob.



[ Reply to This | # ]
Long File names and Internet Explorer
Authored by: Paul Burney on Apr 06, '02 09:11:15PM

Another problem with long file names has to do with Internet Explorer reading local files. I've noticed this with MySQL documentation and others.

For example, the location:

file://localhost/Reference/mysql_manual/manual_MySQL_Database_Administration.html

results in a "File not found" error, even though the file with that exact name exists in that location in the Finder. In fact, other browsers (iCab, NS 6.2, OmniWeb) display the file fine.

(Another pet peeve: On the mac, all of the browsers reference files on the hard drive in a different way. Arghh...)



[ Reply to This | # ]
Stuff Stuffit
Authored by: el bid on Apr 07, '02 05:31:50AM

As someone coming to Mac OS X from the GNU/Linux environment (and NeXTStep before that) I've always been amazed at the hold a proprietory compression utility like Stuffit has over Mac users. Compression is a "common resource", and if any kind of software belongs in the proprietory domain (does it?) this ain't it.

If the Stuffit format offered any visible advantage over zip and tgz there might be an argument for it. I assume it has some kind of resource fork handling unknown to the standard and free UNIX utilities, but where this isn't required it's probably best avoided, IMHO.

--
el bid



[ Reply to This | # ]