查找某目錄下某類文件
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
