如何在 Mac OS X 中隐藏文件夹?

Has*_*ame 5 mac osx-leopard macos

如何在 Mac OS X 中隐藏文件夹?也可以用密码保护文件夹

The*_*cle 11

您不需要在名称的开头添加句点,您可以通过终端中的 leopard 命令使用作为 Apple HFS+ 文件系统一部分的隐形位:

chflags hidden ~/MyFiles
Run Code Online (Sandbox Code Playgroud)

这会隐藏您的 MyFiles 文件夹。您可以在此处详细阅读该命令:

chflags 手册页

大胆的火球:隐形位

您还可以使用此 applescript 在 finder 中切换显示隐藏和未隐藏文件(我将其编译为通过 quicksilver 触发的应用程序):


set onOff to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if onOff = "NO" or onOff = "OFF" then
    set newState to "show"
    set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles ON"
else
    set newState to "hide"
    set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles OFF"
end if

display dialog "Are you sure you want to " & newState & " hidden files? (This will restart the Finder)" buttons {"Cancel", "OK"} default button 2
copy result as list to {buttonPressed}
if buttonPressed is "OK" then
    try
        tell application "Finder" to quit
        do shell script OnOffCommand
        delay 1
        tell application "Finder" to launch
    end try
end if
Run Code Online (Sandbox Code Playgroud)

密码保护文件夹?我这样做的方法是使用磁盘实用程序制作一个加密的 DMG,并在需要时安装它。您可能会喜欢并将 DMG 图标更改为文件夹图标,并使用隐形位将其隐藏以获得完整效果:-)

如果你想花一些钱做这件事:间谍活动