pombreda / peazip

Automatically exported from code.google.com/p/peazip
0 stars 0 forks source link

Extraction without recreating the full parent path tree #30

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently both "Extract" and "Extract without paths" extraction options works 
exactly as in the command line version of the 7z backend binary (from 7-Zip 
project), so:
- "Extract" will rebuild the path as it is saved in the archive
- "Extract without paths" will extract all files in the same specified output 
path

An intermediate option of extracting a subfolder without recreating the full 
parent path cannot be performed by 7z executable; it would require either 
expanding the functions of 7-Zip's 7z or some second pass workaround to locate 
and move the extracted output, which is a less good solution since it will work 
from the GUI but will not work the same way if the job is saved and launched as 
batch.

Original issue reported on code.google.com by giorgio.tani.software@gmail.com on 19 Nov 2010 at 3:22

GoogleCodeExporter commented 9 years ago
Issue 42 has been merged into this issue.

Original comment by giorgio.tani.software@gmail.com on 16 Dec 2010 at 8:08

GoogleCodeExporter commented 9 years ago

Original comment by giorgio.tani.software@gmail.com on 16 Dec 2010 at 8:09

GoogleCodeExporter commented 9 years ago
The merged issue (http://code.google.com/p/peazip/issues/detail?id=42) is not a 
duplicate as I was talking about single file extraction, not subfolder 
extraction.

Single file extraction works fine in the 7z.exe that is packaged with PeaZip 
3.5.1.

Command:
**************************************************
C:\Program Files\PeaZip\res\7z>7z e drupal-7.0-rc1.tar 
drupal-7.0-rc1\themes\tests\README.txt

7-Zip 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Processing archive: drupal-7.0-rc1.tar

Extracting  drupal-7.0-rc1\themes\tests\README.txt

Everything is Ok

Size:       263
Compressed: 11622400
**************************************************

Directory contents afterwards:
**************************************************
C:\Program Files\PeaZip\res\7z>dir
 Volume in drive C has no label.
 Volume Serial Number is 5E31-B48F

 Directory of C:\Program Files\PeaZip\res\7z

17/12/2010  09:40 AM    <DIR>          .
17/12/2010  09:40 AM    <DIR>          ..
18/11/2010  05:27 PM           914,432 7z.dll
18/11/2010  05:08 PM           163,840 7z.exe
18/11/2010  05:27 PM           171,520 7z.sfx
18/11/2010  05:27 PM           160,256 7zCon.sfx
13/12/2010  02:12 PM        11,622,400 drupal-7.0-rc1.tar
02/05/2009  12:18 PM             1,927 License.txt
01/09/2008  08:56 AM               391 note.txt
06/10/2009  12:38 PM               263 README.txt
               8 File(s)     13,035,029 bytes
               2 Dir(s)   9,297,358,848 bytes free
**************************************************

Interestingly, extracting the subfolder works too, but it creates empty paths 
where the extracted files were.

Command:
**************************************************
C:\Program Files\PeaZip\res\7z>7z e drupal-7.0-rc1.tar 
drupal-7.0-rc1\themes\tests\

7-Zip 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Processing archive: drupal-7.0-rc1.tar

Extracting  drupal-7.0-rc1\themes\tests
Extracting  drupal-7.0-rc1\themes\tests\test_theme
Extracting  drupal-7.0-rc1\themes\tests\test_theme\template.php
Extracting  drupal-7.0-rc1\themes\tests\test_theme\test_theme.info
Extracting  drupal-7.0-rc1\themes\tests\README.txt
Extracting  drupal-7.0-rc1\themes\tests\update_test_basetheme
Extracting  
drupal-7.0-rc1\themes\tests\update_test_basetheme\update_test_basetheme.info
Extracting  drupal-7.0-rc1\themes\tests\update_test_subtheme
Extracting  
drupal-7.0-rc1\themes\tests\update_test_subtheme\update_test_subtheme.info

Everything is Ok

Folders: 4
Files: 5
Size:       2796
Compressed: 11622400
**************************************************
Directory Contents:
**************************************************
C:\Program Files\PeaZip\res\7z>dir
 Volume in drive C has no label.
 Volume Serial Number is 5E31-B48F

 Directory of C:\Program Files\PeaZip\res\7z

17/12/2010  09:46 AM    <DIR>          .
17/12/2010  09:46 AM    <DIR>          ..
18/11/2010  05:27 PM           914,432 7z.dll
18/11/2010  05:08 PM           163,840 7z.exe
18/11/2010  05:27 PM           171,520 7z.sfx
18/11/2010  05:27 PM           160,256 7zCon.sfx
13/12/2010  02:12 PM        11,622,400 drupal-7.0-rc1.tar
02/05/2009  12:18 PM             1,927 License.txt
01/09/2008  08:56 AM               391 note.txt
06/10/2009  12:38 PM               263 README.txt
22/08/2010  11:46 PM               765 template.php
01/12/2010  06:55 PM    <DIR>          tests
01/12/2010  06:55 PM    <DIR>          test_theme
01/12/2010  06:55 PM             1,065 test_theme.info
01/12/2010  06:55 PM    <DIR>          update_test_basetheme
01/12/2010  06:55 PM               336 update_test_basetheme.info
01/12/2010  06:55 PM    <DIR>          update_test_subtheme
01/12/2010  06:55 PM               367 update_test_subtheme.info
              12 File(s)     13,037,562 bytes
               6 Dir(s)   9,297,408,000 bytes free
**************************************************

Original comment by gmcdonald@vividas.com on 16 Dec 2010 at 10:47

GoogleCodeExporter commented 9 years ago
You are testing 7z's "e" operation, which is "extract without paths" I was 
referring to in the original entry: it extracts all files and creates all 
directories (as in your second test) in the output path without preserving the 
original tree structure (that's why in you second test dirs are empty, as all 
objects are moved to the root level of the output).

The 7z's "x" operation instead will extract the content recreating the full 
tree, both levels up and below the items selected for extraction.

7z does not currently offer other types of extraction in order to natively 
extract the selected content without recreating the full parent tree, but 
preserving when needed the tree structure of child directories.
It either totally ignore tree structure (e) or fully recreate it (x).

To overcome this limitation I've implemented optional switches in Options > 
Settings > Open archive > Advanced to ignore parths (using "e" extraction") for 
"flat" extraction.
As mentioned, applying e instead of x operation in 7z will result in losing all 
information about the directory tree, not only for parents level as desired, so 
this option is applied only for files but is overridden if a direcory is 
selected.

This optional flag (which mitigate, but not resolve this limitation of 7z 
extraction interface) was not jet implemented for drag and drop operations in 
PeaZip, but as the issue is directly dependent from the lack of an extraction 
interface for extraction without recreating parent tree from 7z, I merged this 
issue with 30.

Original comment by giorgio.tani.software@gmail.com on 17 Dec 2010 at 8:49

GoogleCodeExporter commented 9 years ago
Thanks Giorgio, that's exactly what I was after :)

Original comment by gmcdonald@vividas.com on 19 Dec 2010 at 9:43

GoogleCodeExporter commented 9 years ago
PeaZip 3.6 has a switch for apply "ignore paths" directive (same as "e" 
extraction instead of "x") to drag and drop extraction operations, in Options > 
Settings, Open archive tab; the switch is falgged by default.

As explained, due to current limitation of the underlying extraction binary 
used by PeaZip this is not the same of shortening the path of the extracted 
objects removing the parent path, as "e" extraction is a flat extraction that 
lose all path's information up and below the selected object's level.

The directive is applied only when working on files, if a directory is selected 
for extraction the directive is bypassed for the whole operation (even if files 
are selected alongside the directory) so the directory tree is respected and 
all extracted objects have the same relative path they had in the archive.

Original comment by giorgio.tani.software@gmail.com on 26 Dec 2010 at 1:20