Skip to content

Instantly share code, notes, and snippets.

@razola
Last active February 18, 2017 22:51
Show Gist options
  • Save razola/1443692 to your computer and use it in GitHub Desktop.
Save razola/1443692 to your computer and use it in GitHub Desktop.
Applescript that toggles hidden files

Paste the script into a new file in the AppleScript Editor and save it as an application. Then "Spotlight" and execute the app to quickly hide or show hidden files.

try
set state to do shell script "defaults read com.apple.finder AppleShowAllFiles" as string
if state is "OFF" then
do shell script "defaults write com.apple.finder AppleShowAllFiles ON"
else
do shell script "defaults write com.apple.finder AppleShowAllFiles OFF"
end if
on error
do shell script "defaults write com.apple.finder AppleShowAllFiles ON"
end try
tell application "Finder" to quit
delay 0.5
tell application "Finder" to launch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment