Skip to content

Instantly share code, notes, and snippets.

@marko37
Created April 8, 2016 19:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marko37/1bdc0d8421264d005b81d6e9cff57c39 to your computer and use it in GitHub Desktop.
Save marko37/1bdc0d8421264d005b81d6e9cff57c39 to your computer and use it in GitHub Desktop.
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