Skip to content

Instantly share code, notes, and snippets.

@marko37

marko37/.md

Created Apr 8, 2016
Embed
What would you like to do?
7-Zip 15.14 - paths in list files and the new -spf switch

Here are some tests of 7-Zip 15.14 (released in 2015-12-31) showing how it deals with relatives and absolutes paths in list files.

+=====================+=====================+==========================+===========================+
| content of list.txt | 7z a p.7z @list.txt | 7z a p.7z -spf @list.txt | 7z a p.7z -spf2 @list.txt |
+=====================+=====================+==========================+===========================+
| /tmp/dir1/file.txt  | file.txt            | /tmp/dir1/file.txt       | tmp/dir1/file.txt         |
+---------------------+---------------------+--------------------------+---------------------------+
| dir1/file.txt       | dir1/file.txt       | dir1/file.txt            | dir1/file.txt             |
+---------------------+---------------------+--------------------------+---------------------------+
| ./dir1/file.txt     | file.txt            | ./dir1/file.txt          | file.txt                  |
+---------------------+---------------------+--------------------------+---------------------------+
| /tmp/dir1/file.txt  | error               | /tmp/dir1/file.txt       | tmp/dir1/file.txt         |
| /tmp/dir2/file.txt  |                     | /tmp/dir2/file.txt       | tmp/dir2/file.txt         |
+---------------------+---------------------+--------------------------+---------------------------+
| dir1/file.txt       | dir1/file.txt       | dir1/file.txt            | dir1/file.txt             |
| dir2/file.txt       | dir2/file.txt       | dir2/file.txt            | dir2/file.txt             |
+---------------------+---------------------+--------------------------+---------------------------+
| ./dir1/file.txt     | error               | ./dir1/file.txt          | error                     |
| ./dir2/file.txt     |                     | ./dir2/file.txt          |                           |
+---------------------+---------------------+--------------------------+---------------------------+

Here are the outputs of some tests. The switch -bb makes 7-Zip to show the processed files and paths.

$ cat list.txt 
/tmp/dir1/file.txt

$ 7z a p.7z -bb @list.txt

7-Zip (a) [64] 15.14 : Copyright (c) 1999-2015 Igor Pavlov : 2015-12-31
p7zip Version 15.14.1 (locale=pt_BR.UTF-8,Utf16=on,HugeFiles=on,64 bits,2 CPUs x64)

Scanning the drive:
1 file, 4 bytes (1 KiB)

Creating archive: p.7z

Items to compress: 1

+ file.txt
    
Files read from disk: 1
Archive size: 130 bytes (1 KiB)
Everything is Ok
$ cat list.txt 
/tmp/dir1/file.txt
/tmp/dir2/file.txt

$ 7z a p.7z -spf -bb @list.txt

7-Zip (a) [64] 15.14 : Copyright (c) 1999-2015 Igor Pavlov : 2015-12-31
p7zip Version 15.14.1 (locale=pt_BR.UTF-8,Utf16=on,HugeFiles=on,64 bits,2 CPUs x64)

Scanning the drive:
2 files, 9 bytes (1 KiB)

Creating archive: p.7z

Items to compress: 2

+ /tmp/dir1/file.txt
+ /tmp/dir2/file.txt
      
Files read from disk: 2
Archive size: 190 bytes (1 KiB)
Everything is Ok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment