9

There are several ways how to toggle hidden files - via a shell command, or AppleScript, or Automator action, or even a Dashboard widget. All of them close and reopen Finder windows, which is quite annoying.

On the other hand, for the Open File dialog one can easily toggle hidden files by pressing Command+Shift+Period.

Is it possible to avoid relaunching Finder?


Conclusion

It is better to use Path Finder instead, which allows not only to toggle hidden files without a perversion, but many other nice things. Really awesome app.

Andy
  • 1,674

3 Answers3

3

There is a solution now.

The latest release of TotalFinder (0.9.1) can toggle show/hide hidden files without Finder restart. Tested it, it works well, and removes this long-lived annoyance of the Finder. TotalFinder is free for now as it is prerelease software, but will be around $10 or $15 when it hits final.

CharlesB
  • 573
1

No, you cannot, because there is no way to notify the Finder (or any process for that matter) that its preferences file has been modified behind its back.

Hasaan Chop
  • 4,906
0

I found a similar question here: Apple Script - Reopen Closed Finder Windows

The posted script by adayzdone may be what your looking for. It still has to relaunch Finder but when it relaunches, it returns the the same windows in the same directory you were in when they closed.

tell application "Finder"
   set windowTargets to target of Finder windows
    quit
end tell

set OnOff to do shell script "defaults read com.apple.finder AppleShowAllFiles"
    if OnOff = "NO" or OnOff = "OFF" then
        set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles ON"
    else
        set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles OFF"
    end if
    do shell script OnOffCommand
    delay 1

tell application "Finder" to launch
    tell application "Finder"
    repeat with aTarget in windowTargets
        make new Finder window at aTarget
    end repeat
end tell

copied from referenced question

davidcondrey
  • 1,748