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

7

5

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?

wahnfrieden

Posted 2009-10-25T09:33:35.163

Reputation: 291

As for your there seems to be an option for hiding that file type: if you're referring to the checkbox "Hide extension" in the "Name & Extension" pane, then that would only remove the ".pyc" part from the views. The rest of the file name would still be shown. – Arjan – 2009-10-25T10:16:25.233

Answers

8

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.

Benjamin Schollnick

Posted 2009-10-25T09:33:35.163

Reputation: 4 313

(Added a warning about ls...) – Arjan – 2009-10-25T11:38:09.373

1Well that's unfortunate. Thank you for the answer. – wahnfrieden – 2009-10-26T03:57:58.860