windows - 从 Windows 目录中的所有 zip 中删除 __MACOSX 文件夹和 .DS_Store 文件
问题描述
我在某个目录上有一个相当大的 zip 文件列表,每个目录都包含一个 __MACOSX 文件夹和 .DS_Store 文件。有什么办法可以运行一些批处理来从每个 zip 中删除文件夹和文件,而不必先解压缩它们?我不太喜欢 shell 脚本,我尝试了一些命令无济于事。
解决方案
这个答案假设您有办法在 Windows 上运行 zip 程序和 bash。
IE。使用适用于 Windows 10 的 Ubuntu shell https://tutorials.ubuntu.com/tutorial/tutorial-ubuntu-on-windows
- 为 Windows 启用 Ubuntu
sudo apt-get update; sudo apt-get install -y zip
一旦你有一个兼容的环境
首先备份您的 zip 文件目录,以防此命令在您的系统上无法正常工作。
其次,如果您使用 bash 并安装了 zip 程序,请运行以下命令。
cd $directory_with_zips
for file in `ls`; do echo $archive; zip -d $archive __MACOSX; done
https://superuser.com/questions/600385/remove-single-file-from-zip-archive-on-linux
推荐阅读
- spring-boot - 在 Mockito Junit 中 @InjectMocks 后为空
- java - RecyclerView 没有 LayoutManager android.support.v7.widget.RecyclerView
- python - 如何使用 Python 制作直方图,就像使用 R hist 函数一样
- php - trim() 期望参数 1 是字符串,给定对象,Wordpress
- algorithm - 如何在数组中找到一个峰值?
- node.js - 标头崩溃应用程序,错误类型错误:未定义不是对象(评估“theme.label”)
- java - 如何使用 java + hibernate 将值插入 SQL Server 中的主键?
- html - 在小屏幕上对齐标题和段落左侧的图像,然后在它们之间对齐
- xamarin - 创建 xamarin 应用程序时找不到“使用 PCL 的跨平台”
- python-3.x - 为python创建一个常规语法“编译器”