1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| #!/bin/sh #
# author: cx # # 使用方法:打开终端 -> 执行./rm.DS_Store.sh [可选文件夹路径] # 例如:./rm.DS_Store.sh # ./rm.DS_Store.sh ~/Downloads #
# Terminal work directory twd=$(pwd) # Script work directory swd=$(cd $(dirname $0); pwd)
find ${1:-$swd} \ -path ~/Library -prune -o \ -name ".DS_Store" \ -exec rm {} \; \ -exec echo {} removed \;
# echo All .DS_Store have been removed" echo "\033[32mAll .DS_Store have been removed\033[0m"
|