3

On a Unix system (or more specifically on Mac OS X) is it possible to show hidden files in only some directories? For example as a developer I want to see the hidden files in my Ruby on Rails projects but not on my desktop as well.

I guess I'm just tired of seeing all these .DS_Store and .trashes files swimming around, any remedies not directly related are welcome too!

5 Answers 5

1

Opening your project directory with a text editor such as TextMate (Great for RoR!), shows you all the files.

If not, it may be useful to add ".*|" at the beginning of the file pattern you will find in TextMate's Preferences > Advanced > File Pattern:

P.S. I'm not aware of any way to show invisible files only for a given directory. But i would rather not do it if it is possible. I prefer working with the terminal for this sort of things. It's even cooler with TextMate's Command line tool, type:

$ mate any_file_or_directory

...to open it in TextMate

2

Undirectly related solutions welcome?

Well, I recently came across this tutorial which allows you to use the Shift-Cmd-Period shortcut that's already usable in open/save dialog boxes inside Finder as well. It does involve restarting Finder, but since all the windows are all restored it's relatively seamless.

Quite stupid that Finder doesn't have such functionality built in if the open/save dialogs do have such functionality, but ah well.

1

you can write a shell script, eg with bash

shopt -s dotglob
for file in my_rails_directory1/.*  my_rails_directory2/.*
do
 echo $file
done 
2
  • dotglob is pointless when you manually use .* Mar 19, 2010 at 15:38
  • i leave it there in case OP want to list all files, not only hidden
    – user31894
    Mar 19, 2010 at 15:44
1

Does not do precisely what you want, but I use the hiddenfiles widget to toggle visibility. This affects all folders off course, but it's quick to use.

1

Yes - sort of. Just some folders?! Interesting idea.

Symlink to the hidden dir

 ln -s ~/.ssh ~/ssh

this will put an alias type folder you can double click to ~/.ssh etc

Command Period in Finder Hit [command]-[period] together to show hidden files like the screenshot. Then double clicking on say..... .ssh directory

Resource Fork Try to create a resource fork for the hidden directory.

In the Terminal To just show hidden dirs try:

ls -A | grep '^\.'

That will list all files, including those that start with a period. Grep will filter it to only show lines starting with a dot. Command period also works in file dialogs to show hidden. They appear a bit ghostly and pale.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .