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?

  • 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 Oct 25 '09 at 10:16

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.

  • (Added a warning about ls...) – Arjan Oct 25 '09 at 11:38
  • 1
    Well that's unfortunate. Thank you for the answer. – wahnfrieden Oct 26 '09 at 3:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.