mac系统删除.DS_Store文件

查找某目录下某类文件

find . -name ".DS_Store" -type f -print

# find: 主命令  
# . : 当前目录下(可变)  
# -name: 通过名查找  
# ".DS_Store": 后缀  
# -type f: 一般正规文件  
# -print: 查询结果打印

eg: 查找当前目录下所有的.html文件, 并打印就应该使用
find . -name ".html" -type f -print

find . -name ".DS_Store" -type f -print -exec command {} \;

# -exec: 命令扩展,查询结束后要执行 command 命令
# {}: 查询结果放到 {} 中
# \;: 扩展命令结束符,表示 到 ; 结束

eg: 找到.html后,删除所有的查询结果,应使用:
find . -name ".DS_Store" -type f -print -exec rm -rf {} \;

不让 mac os 生成 .DS_Store 文件

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

猜你喜欢

转载自blog.csdn.net/weixin_41610178/article/details/81216830