Had to make these little scripts today.
All they do is change AppleShowAllFiles to either YES or NO and then relaunch the Finder.
No warranties for this, just thought it may help somebody out.
WARNING: This May Not Work, Or May Break Something. Keeping it online for reference only.
Script contents below:
#!/bin/bash defaults write com.apple.Finder AppleShowAllFiles NO killall Finder && open /System/Library/CoreServices/Finder.app
You may need to chmod +x to get these to run.
Download Show Hide Mac Files / Folders Script.zip Download removed as I no longer use this, and I’m not sure if it still works.