$ touch {a,b,c,d}
$ ls
a b c d
$ ls -ltrh
total 0
-rw-r--r-- 1 user1 staff 0B 2 1 16:44 d
-rw-r--r-- 1 user1 staff 0B 2 1 16:44 c
-rw-r--r-- 1 user1 staff 0B 2 1 16:44 b
-rw-r--r-- 1 user1 staff 0B 2 1 16:44 a
$ vi filelist
$
$ cat ./filelist
a
b
c
d
$ cat ./filelist | zip -@ ./test.zip
adding: a (stored 0%)
adding: b (stored 0%)
adding: c (stored 0%)
adding: d (stored 0%)
$ ls
a b c d filelist test.zip
$ mkdir result
$ unzip ./test.zip -d $_
Archive: ./test.zip
extracting: ./result/a
extracting: ./result/b
extracting: ./result/c
extracting: ./result/d
$ ls ./result/
a b c d
$
In case that there are several files in a directory, and partially you wanna zip, you can specify which file you wanna zip thorough file-list or standard input.
Ramdom thoughts of a data scientist. Mainly Machine learning, Deep learning, Bayesian inference, Python, Linux...
Thursday, February 1, 2018
How to use '@' option in zip command ??
You can specify files to be zipped from standard input by using '@' option as following.
Labels:
Linux
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment