Author Topic: How to set packer filter properly to keep empty folders?  (Read 19359 times)

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 555
  • Old Skull
    • View Profile
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?

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4488
    • View Profile
    • Multi Commander
Re: How to set packer filter properly to keep empty folders?
« Reply #1 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.

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 555
  • Old Skull
    • View Profile
Re: How to set packer filter properly to keep empty folders?
« Reply #2 on: July 16, 2016, 20:34:39 »
But if I just pack empty folder without filter, it is added to archive.

AlanJB

  • VIP Member
  • *****
  • Posts: 436
  • VERY old Programmer
    • View Profile
Re: How to set packer filter properly to keep empty folders?
« Reply #3 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

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4488
    • View Profile
    • Multi Commander
Re: How to set packer filter properly to keep empty folders?
« Reply #4 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.
« Last Edit: July 17, 2016, 00:37:16 by Mathias (Author) »

AlanJB

  • VIP Member
  • *****
  • Posts: 436
  • VERY old Programmer
    • View Profile
Re: How to set packer filter properly to keep empty folders?
« Reply #5 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

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4488
    • View Profile
    • Multi Commander
Re: How to set packer filter properly to keep empty folders?
« Reply #6 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.