Gor*_*don 4 linux zip file-management bash shell
有时我会做一个命令,比如
unzip tons_of_files.zip
Run Code Online (Sandbox Code Playgroud)
我会忘记把 -d 指向一个子目录。这会导致当前文件夹充满大量与现有文件混合的文件。
删除所有这些新文件和/或将它们移动到新目录的最佳方法是什么?我想避免手动检查目录并确定文件是存档的一部分还是已经存在。
一种快速的方法可能如下:
unzip -qql tons_of_files.zip | while read -r l d t n ; do rm -fr "$n" ; done
Run Code Online (Sandbox Code Playgroud)
由于这会自动擦除:使用它需要您自担风险。要查看预览,请替换... rm ...为... echo rm ....
| 归档时间: |
|
| 查看次数: |
476 次 |
| 最近记录: |