MACRO: Finder: Show/Hide Hidden Files

##MACRO: Finder: Hidden Files: Show

defaults write com.apple.finder AppleShowAllFiles -bool true && pkill Finder

##MACRO: Finder: Hidden Files: Hide

defaults write com.apple.finder AppleShowAllFiles -bool false && pkill Finder

NOTE:

I updated the above examples to use “-bool true” and “-bool false”, because, as @Tom pointed out to me, my original code was turing the value into a string.

Thanks, @Tom. :stuck_out_tongue:

I’ve always done this with one macro using an AppleScript. The script switches between hidden files being shown or not based on their current state.

if {"OFF", "FALSE"} contains (do shell script "defaults read com.apple.finder AppleShowAllFiles") then
   set theValue to "TRUE"
else
   set theValue to "FALSE"
end if

do shell script ("defaults write com.apple.finder AppleShowAllFiles " & theValue) as string
do shell script "killall Finder"

delay 2

tell application "Finder"
   activate
end tell
1 Like

Just read that Cmd-Shift-. (period) does this, at least since Sierra.

1 Like