[英]Zip multiple directories into one zip file
$ cat /home/myapp/properties.csv
/document/source/
/downloads/lib/
/home/app/newFiles/
The above is a simple file that holds all the directories I'm interested in... 上面是一个简单的文件,其中包含我感兴趣的所有目录...
$ cat /home/myapp/zipup.sh
#!/bin/bash
folder="/home/myapp/properties.csv"
cat $folder| while read dir;
//zip all the directories read in
How do I complete zipup.sh
script so that all directories and contents in each of the directories defined in the properties file are included in a single zip file ie the result should be something like this... 我如何完成
zipup.sh
脚本,以便将属性文件中定义的每个目录中的所有目录和内容都包含在单个zip文件中,即结果应该是这样的...
/result.zip (everything goes in here)
/source
/hello.class
/hello.jar
/lib
/xml.jar
/newFiles
/list.doc
#!/bin/bash
while read dir; do
dirs="$dirs $dir"
done < /home/myapp/properties.csv
zip -r result $dirs
#!/bin/bash
while read dir; do
zip result.zip $dir;
done < /home/myapp/properties.csv
The zip command will add new entries to the same zipfile. zip命令会将新条目添加到同一zipfile中。
Please note that zip will overwrite entries with the same name. 请注意,zip将覆盖具有相同名称的条目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.