(name = '*.*') does not mean all files

Sep 15, 2011 at 6:55 PM

Using a selectionCriteria of (name = '*.*') in AddSelectedFiles does not include files with no extension. This goes against convention (which since the DOS days has said that '*.*' matches all files, even those without an extension) and DotNetZip's own documentation. Using just "*" works.

From the AddSelectedFiles(string) documentation page: "a pattern of "*.*" matches all files in all directories".

The following two logs (which are generated from my own SaveProgress event handler) show the difference when zipping the exact same directory containing files with no extension (using ver. 1.9 packed Sat-08-06-2011-215945.06):

Adding files from 'd:\junk' to path '' in the zip file  using the following criteria:
( (name = '*.*')) AND (name != '*.obj')
----------------------------------------------
Starting saving and compression of zip file C:\Users\foobar\AppData\Local\Temp\ZipFileCache_Leg\junk2.zip.
   Entry#: (Uncompressed Size/Compressed size) - Compression Ratio: Path

     1: (    2,079.38 KiB/      254.24 KiB) - 88 %: comptestcopy.log
     2: (       91.84 KiB/       14.22 KiB) - 85 %: TestCopy.log
     3: (    1,840.45 KiB/      225.35 KiB) - 88 %: uncomptestcopy.log
     4: (        0.24 KiB/        0.15 KiB) - 40 %: vhdcomptest.ps1
     5: (        0.44 KiB/        0.23 KiB) - 47 %: vhduncomptest.ps1
     6: (        0.03 KiB/        0.02 KiB) - 12 %: Dir1/Dir1.txt
     7: (        0.03 KiB/        0.02 KiB) - 23 %: Dir1/Dir3/Dir3.txt
     8: (        0.03 KiB/        0.02 KiB) - 15 %: Dir2/Dir2.txt
     9: (        0.03 KiB/        0.02 KiB) - 15 %: Dir2/Dir3/Dir3_2.txt

Saving and compression of zip file C:\Users\foobar\AppData\Local\Temp\ZipFileCache_Leg\junk2.zip complete.
----------------------------------------------

Adding files from 'd:\junk' to path '' in the zip file  using the following criteria:
( (name = '*')) AND (name != '*.obj')
----------------------------------------------
Starting saving and compression of zip file C:\Users\foobar\AppData\Local\Temp\ZipFileCache_Leg\junk3.zip.
   Entry#: (Uncompressed Size/Compressed size) - Compression Ratio: Path

     1: (    2,079.38 KiB/      254.24 KiB) - 88 %: comptestcopy.log
     2: (        0.02 KiB/        0.02 KiB) - 8 %: TestFile
     3: (       91.84 KiB/       14.22 KiB) - 85 %: TestCopy.log
     4: (    1,840.45 KiB/      225.35 KiB) - 88 %: uncomptestcopy.log
     5: (        0.24 KiB/        0.15 KiB) - 40 %: vhdcomptest.ps1
     6: (        0.44 KiB/        0.23 KiB) - 47 %: vhduncomptest.ps1
     7: (        0.03 KiB/        0.02 KiB) - 12 %: Dir1/Dir1.txt
     8: (        0.00 KiB/        0.00 KiB) - 0 %: Dir1/
     9: (        0.03 KiB/        0.02 KiB) - 23 %: Dir1/Dir3/Dir3.txt
    10: (        0.03 KiB/        0.02 KiB) - 15 %: Dir2/Dir2.txt
    11: (        0.02 KiB/        0.02 KiB) - 10 %: Dir2/NoExtension
    12: (        0.00 KiB/        0.00 KiB) - 0 %: Dir2/
    13: (        0.03 KiB/        0.02 KiB) - 15 %: Dir2/Dir3/Dir3_2.txt

Saving and compression of zip file C:\Users\foobar\AppData\Local\Temp\ZipFileCache_Leg\junk3.zip complete.
----------------------------------------------

Note the addition of the two files "TestFile" and "NoExtension" in the second case.

While it's possible to make things work because you can use '*', this should be fixed. In many cases the selection criteria are entered by users.

Coordinator
Sep 15, 2011 at 7:09 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.