Created
July 2, 2024 14:10
-
-
Save zty5678/373f97360e333e7b4c524ce5973b98e0 to your computer and use it in GitHub Desktop.
clean .DS_Store and __MACOSX in zip file on Mac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| for f in "$@" | |
| do | |
| # 获取文件类型,以确保是 Zip 压缩文件 | |
| fileType=$(file -bI "$f") | |
| echo "fileType= $fileType" | |
| if [[ $fileType =~ application/zip.* ]]; then | |
| # 删除 __MACOSX 与 .DS_Store 文件 | |
| zip -d "$f" \*__MACOSX\* || true | |
| zip -d "$f" \*.DS_Store\* || true | |
| fi | |
| done | |
| osascript -e "display notification \"zip文件清理成功\" with title \"提示\"" |
Author
zty5678
commented
Jul 2, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment