After restoring a backup, the various OS X system folders became visible again (such as /bin /mach_kernel etc)

The following command (adapted from this post by Wowzera) will hide them again:

# Hide sym-links
for cdir in /etc /tmp /var;
    do sudo $SETFILECMD -P -a V $cdir;
# Hide directories
for cdir in /bin /cores /mach_kernel /private /sbin /usr /Volumes; do
    sudo $SETFILECMD -a V $cdir;

Launch Terminal (in Applications, then Utilities), and paste the above script.

You'll need the Developer Tools installed - they are on the OS X installer disc, or you can get them from the Apple Developer Connection site.. although it's a pretty big download, about 1GB), so..

I've also mirrored SetFile here - SetFile.gz - download that, extract it (just double click it), and change the SETFILECMD="/Developer/Tools/SetFile"to point to the new file - for example, if it's in your "Downloads" folder:


Oh, if you're seeing a bunch of files with names starting with . - hidden files, there's a different solution:

defaults write AppleShowAllFiles -boolean false
killall Finder