unzip '*.zip'
但是它会提取当前文件夹中的所有文件.
解决方法 你可以这样做:for file in *.zip; do dir=$(basename "$file" .zip) # remove the .zip from the filename mkdir "$dir" cd "$dir" && unzip ../"$file" && rm ../"$file" # unzip and remove file if successful cd .. done
或者,在一行上一起运行:
for file in *.zip; do dir=$(basename "$file" .zip); mkdir "$dir"; cd "$dir"; unzip ../"$file" && rm ../"$file"; cd ..; done
如果您需要/想要保留原始.zip文件,只需删除&& rm ../\”$file“位.
总结以上是内存溢出为你收集整理的linux – Unix unzip:如何批量解压缩文件夹中的zip文件并保存在子文件夹中?全部内容,希望文章能够帮你解决linux – Unix unzip:如何批量解压缩文件夹中的zip文件并保存在子文件夹中?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)