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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM