Skip to content

Instantly share code, notes, and snippets.

@allanburleson
Created July 26, 2016 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allanburleson/df70b20eb476dc1036de2123d601b8d4 to your computer and use it in GitHub Desktop.
Save allanburleson/df70b20eb476dc1036de2123d601b8d4 to your computer and use it in GitHub Desktop.
Show/hide hidden files on macOS
#!/usr/bin/python
import subprocess
import sys
def help():
print('hiddenfiles show|hide')
if len(sys.argv) == 2:
if sys.argv[1] == "show":
subprocess.call(['defaults','write','com.apple.finder','AppleShowAllFiles','TRUE'])
subprocess.call(['killall', 'Finder'])
elif sys.argv[1] == "hide":
subprocess.call(['defaults','write','com.apple.finder','AppleShowAllFiles','FALSE'])
subprocess.call(['killall', 'Finder'])
else:
help()
else:
help()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment