Last active
August 29, 2015 14:19
-
-
Save amandeepjutla/16fb89950ea64d43096f to your computer and use it in GitHub Desktop.
Simple script that toggles visibility of hidden files in OS X. It requires Python 2.7.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# vision | |
import subprocess | |
output = subprocess.check_output( | |
["defaults", "read", "com.apple.finder", "AppleShowAllFiles"]) | |
if "NO" in output: | |
subprocess.call(["defaults", "write", "com.apple.finder", | |
"AppleShowAllFiles", "YES"]) | |
subprocess.call(["killall", "Finder"]) | |
print "Hidden files are now visible." | |
if "YES" in output: | |
subprocess.call(["defaults", "write", "com.apple.finder", | |
"AppleShowAllFiles", "NO"]) | |
subprocess.call(["killall", "Finder"]) | |
print "Hidden files are now hidden." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment