以下脚本在 Mavericks 上不起作用:
# check if hidden files are visible and store result in a variable
isVisible=”$(defaults read com.apple.finder AppleShowAllFiles)”
# toggle visibility based on variables value
if [ "$isVisible" = FALSE ]
then
defaults write com.apple.finder AppleShowAllFiles -boolean true
else
defaults write com.apple.finder AppleShowAllFiles -boolean false
fi
# force changes by restarting Finder
killall Finder
更新:
但下面的脚本可以工作:
defaults write com.apple.finder AppleShowAllFiles -boolean true
killall Finder
答案1
Apple Script 版本运行良好:
on run {input, parameters}
set cur_state to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if cur_state = "TRUE" then
do shell script "defaults write com.apple.finder AppleShowAllFiles FALSE"
else
do shell script "defaults write com.apple.finder AppleShowAllFiles TRUE"
end if
do shell script "killall Finder"
return input
end run
答案2
无需太多技术知识,即可快速轻松地获取隐藏文件。借助始终运行且晚上安然入睡的应用程序,即可实现此操作。访问http://www.showhiddenfilesmac.com/获取此应用程序。