Macos – Hiding files of a certain extension (.pyc) from all Finder dialogs

findermacos

Some file types are already hidden by default in Finder, and in all standard file dialogs in OS X (10.6) already. I would like to add a file type to be hidden: anything with the .pyc extension. If I select 'Get Info' on a .pyc file, there seems to be an option for hiding that file type, but it's disabled/grayed out and I don't know why. Is there any other way to hide them?

Best Answer

Well, I wouldn't normally suggest this... But you asked...

Assuming Leopard:

 find -x /path/to/folder -name \*.pyc -exec chflags hidden {} +

Just supply the proper "/path/to/folder". The drawback is that it has to be done periodically for newly created files. And this also hides file from ls in Terminal. From man chflags:

Only a limited number of utilities are chflags aware. Some of these tools include ls, cp, find, install, dump, and restore.

Prior to Snow Leopard, you can try to edit the .hidden file that is in the root of the boot drive. That contains a list of hidden file types... But it doesn't exist on my Snow Leopard system, so it may have only existed in 10.4.