错误解压缩:所有文件分散在当前目录中

On CentOS, I wanted to unzip files in A.zip into ./A/. However, I didn't notice that there were hundreds of files in A.zip and I just use unzip A.zip. So now these extra files are all in the current directory. How could I solve this problem?

非常感谢您的帮助!

评论
Liz
Liz

你可以试试这个-

unzip -Z1是zip信息模式,基本上返回已压缩的文件。然后将输出通过管道传递到其他命令,该命令根据输入(从上一个命令中)删除该文件。

假设,首先您要对该文件夹进行适当的备份。

unzip -Z1 t1.zip | xargs rm -f

t1.zip是我测试过的zip文件。

点赞
评论