Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maximum Filename Characters for zippping

Status
Not open for further replies.

tkambui

Technical User
Feb 15, 2012
10
0
0
Can anyone tell me what is the maximum number of characters there can be in a file name when zipping it?
 
Looking at the file format, the file name length field in the header is only two bytes. So making a wild guess I would say the maximum file name itself would have to be 255 char. (Purely a guess.)



Jeff
[small][purple]It's never too early to begin preparing for [/purple]International Talk Like a Pirate Day
"The software I buy sucks, The software I write sucks. It's time to give up and have a beer..." - Me[/small]
 
..or possibly 65535 (2 bytes = 2^16 or 65536, losing the possibility of 0 length name)

If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Yes, 2 bytes unsigned (only positive N) will enable lengths of 65536 at max, if you won't allow 0 length. But what also matters is what file name lengths OSes support. Windows for example will not allow more than 260 chars (MAX_PATH), even though NTFS itself allows longer names. I don't know the reasoning, legacy software support most probably, or concerns about viruses hiding in lengthy folder strtucutres manually hardly reachable.

ZIP of course is not limited to Windows usage, but as Linux rather uses .gzip or .bzip and MacOS .sit (I think) it will not have much of an impact, that ZIP supports longer names.

Bye, Olaf.

 
Thanks for your replies, but I am looking for the NUMBER OF CHARACTERS. Like there used to be 8.3; or now you can name a file with a max of 255 characters. I did a zip one time and it would not let me because the file names were too long.
 
Characters = bytes/2 in mosta any case. So the OS limit of 260 CHARS is mostly the limiting factor.

tkambui said:
I did a zip one time and it would not let me because the file names were too long.

What was the source of zipping? What file system? Eg even on Windows, a CD typically has the Joilet Filessystem, this allows less, Linux allows many file systems which allow longer names.

No Windows Path can break that limit, but perhaps the ZIP software you used has another limit on top of the file sepcification limit.

Bye, Olaf.
 
Some zip programs count the entire path (drive letter, directory path, and full file name) as the length of the file name. If you have something buried deep in some long named directories, it can add up and cause a failure.

 
Yes, Sam, that's true. Mostly you would rather zip a dir and then only subdirs would add up to more lengthy names, still I see no way to get too long names in any windows dir, even if you zip a drive from it's root, you rather will break other limits, eg file length of the resulting zip archive.

Bye, Olaf.
 
I used WinZip on an XP machine and I'm thinking that the entire path was being counted. Thanks for all the replies.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top