Skip to content

Instantly share code, notes, and snippets.

@tjluoma
Created February 2, 2015 12:43
Show Gist options
  • Select an option

  • Save tjluoma/3bdb5de79ad18f853f52 to your computer and use it in GitHub Desktop.

Select an option

Save tjluoma/3bdb5de79ad18f853f52 to your computer and use it in GitHub Desktop.
This method of showing/hiding Finder files does _not_ require the Finder to be restarted. It was copied directly from http://apple.stackexchange.com/a/168544/9226
-- copied directly from http://apple.stackexchange.com/a/168544/9226
set newHiddenVisiblesState to "YES"
try
set oldHiddenVisiblesState to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if oldHiddenVisiblesState is in {"1", "YES"} then
set newHiddenVisiblesState to "NO"
end if
end try
do shell script "defaults write com.apple.finder AppleShowAllFiles " & newHiddenVisiblesState
tell application "Finder"
set theWindows to every Finder window
repeat with i from 1 to number of items in theWindows
set this_item to item i of theWindows
set theView to current view of this_item
if theView is list view then
set current view of this_item to icon view
else
set current view of this_item to list view
end if
set current view of this_item to theView
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment