Shell · Silent
Toggle Hidden Files
Shows or hides dotfiles and other hidden files in Finder. Finder restarts to apply the change; open windows come back.
- Language
- Shell
- Output
- Silent
- Keyword
hidden- Arguments
- None
- Licence
- MIT
- Author
- Docktopus
- File
- toggle-hidden-files.zsh (727 bytes)
- Downloads
- 0
In Docktopus: Settings → Scripts → Browse Community Scripts. Read the source before you run any script.
Source
toggle-hidden-files.zsh · sha256 f21a737a1910…#!/bin/zsh
# @docktopus.schemaVersion 1
# @docktopus.title Toggle Hidden Files
# @docktopus.mode silent
# @docktopus.icon eye
# @docktopus.keyword hidden
# @docktopus.description Shows or hides dotfiles and other hidden files in Finder. Finder restarts to apply the change; open windows come back.
# @docktopus.author Docktopus
current=$(/usr/bin/defaults read com.apple.finder AppleShowAllFiles 2>/dev/null)
if [[ "$current" == (1|YES|true|TRUE) ]]; then
/usr/bin/defaults write com.apple.finder AppleShowAllFiles -bool false
state="hidden"
else
/usr/bin/defaults write com.apple.finder AppleShowAllFiles -bool true
state="visible"
fi
/usr/bin/killall Finder 2>/dev/null
echo "Hidden files are now $state in Finder."