以下是使用macOS系统自带的功能,而不借用其它App:
如果说的是的老版本Mac OS X系统(具体的版本记不清了,要自己尝试下),可以使用下面的命令禁止产生.DS_Store文件
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
使用下面的命令,禁止在网络共享上生成.DS_Store
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
在U盘根目录生成一个空的.metadata_never_index文件,就可以阻止聚焦(Sportlight)在其上建立索引库
使用mdutil命令也可以禁止在该U盘上搜索或建立索引
下面借用第三方工具的,比如:
CleanEject:这个软件只有2015-02-21的版本2.3,貌似已经停止更新
Hidden Cleaner:只更新到2010年,也没有更新版本
自己动手:
删除所有的._*,.DS_Store, .fseventsd, .Spotlight-V*和.Trash文件的命令行(注:将<your-USB-volume-name>替换为真实的)
find /Volumes/<your-USB-volume-name> -name ._* -o -name .DS_Store -type f -delete
rm -rf /Volumes/<your-USB-volume-name>/.{,_.}{fseventsd,Spotlight-V*,Trashes}
也可以使用macOS系统的命令:
dot_clean -m /Volumes/<your-USB-volume-name>
或者自己做一个自动操作项目,如下如,在选取文件夹处,选择你的U盘然后运行:
![](https://discussionschinese.apple.com/content/attachment/0b4427bf-d2a4-452f-8901-ace393a31d6f)
[经过版主编辑]