Say you installed MacPorts on Mac OS X Leopard (client) and now there is a new folder called “opt” in the root level of the startup disk. To make it invisible in the Finder (but not in Terminal), enter the following command in the Terminal:
sudo SetFile -a V /opt
Make sure to restart the Finder to see the change. To make the folder visible again, enter sudo SetFile -a v /opt (lowercase ‘v’).