Multi Commander Support Forum

Multi Commander => Support and Feedback => Topic started by: Jungle on July 14, 2016, 10:57:53

Title: How to set packer filter properly to keep empty folders?
Post by: Jungle on July 14, 2016, 10:57:53
E.g. i have the following file/dir structure:
Code: [Select]
\txt
  1.txt
  2.txt
1.dat
2.dat
3.txt

If i set pack filter to "-*.txt" then archive will not have txt folder. But i want that folder to be in the archive even it's empty. What is the proper filter?
Title: Re: How to set packer filter properly to keep empty folders?
Post by: Mathias (Author) on July 16, 2016, 12:34:53
Normally folder are not added to a zip. since they are not needed.. Zip store files with full path so having lone folder items is of no use.
So to save space I think it gets stripped away.
Title: Re: How to set packer filter properly to keep empty folders?
Post by: Jungle on July 16, 2016, 20:34:39
But if I just pack empty folder without filter, it is added to archive.
Title: Re: How to set packer filter properly to keep empty folders?
Post by: AlanJB on July 17, 2016, 00:05:46
Actually Zip does allow empty folders by default (at least in a Windows environment).

I have been using WinZip since v6 and that has always been the case.

So do 7zip, zip, Peazip, RAR, LZ, etc...

Alan
Title: Re: How to set packer filter properly to keep empty folders?
Post by: Mathias (Author) on July 17, 2016, 00:34:46
Actually Zip does allow empty folders by default (at least in a Windows environment).

I have been using WinZip since v6 and that has always been the case.

So do 7zip, zip, Peazip, RAR, LZ, etc...

Alan

It is allowed and possible. Just that zip does not NEED it to work. And most of them do not include them. unless the folder are empty.
every item in a zip is stored with its full "in the zip" path.  (not like the filesystem that stores its files is a tree structure ) so you do not need the folder item to place a file inside that..
so many zip libraries do not include them because the spec recommend to not include them since they are only taking up space.  Because they want to create archives that are as small as possible. if you zip a folder structure with 1000x folders and files, all the folders are taking up entries in the archive, and the archive become larger then it has to be.
That is the reason why it is not added. because normally it should not add folder.. except if it is empty

However. Normally MC would include folders entry if it is empty. But the problem here is that when using filters the are some conflicts that make it not add it.
Title: Re: How to set packer filter properly to keep empty folders?
Post by: AlanJB on July 18, 2016, 10:47:04
Thanks for the expanded explanation, Mathias.

As an experiment I just packed (through MC 6.4 Beta), a few files & folders (including empty folders), then opened the .zip in WinZip.

Switched the view in Winzip from "All files" (this is the same as MC) to "Files by Folder" and the two empty folders are, indeed, in the archive.  Seems it depends on how you look inside the archive.

Alan
Title: Re: How to set packer filter properly to keep empty folders?
Post by: Mathias (Author) on July 18, 2016, 11:50:51
Thanks for the expanded explanation, Mathias.

As an experiment I just packed (through MC 6.4 Beta), a few files & folders (including empty folders), then opened the .zip in WinZip.

Switched the view in Winzip from "All files" (this is the same as MC) to "Files by Folder" and the two empty folders are, indeed, in the archive.  Seems it depends on how you look inside the archive.

"Files by Folder" ?
Eh No..  I dont know what winzip does.  But they may choose to not show them or not. I don't know. But it does not have anything to do with that, that is just presentation.
It is about how the zip archive is structured in the file.  How the zip format works.