What options exist for the .hidden file? I wanted to hide certain filetypes in a folder, but simply putting *.out, which I assumed would hide all files ending in .out, didn't work. :(

I'm using Nautilus.

UPDATE: I guess if this option doesn't exist, a bash shell could be created that, when executed in a directory, finds all files with matching endings and writes them to the .hidden file. I don't have any experience with the command-line but I'll try this :).

3 Answers
3

New answer:
It seems you meant something other than I thought you did. You create a literal .hidden file listing all the files you want the Nautilus file manager to hide by default you can use this command (from @Jóhann 's answer):

for i in *.out; do echo "$i"; done > .hidden

Replacing .out with the file extension you wish to hide.

Old answer:

If all the files in question share the same extension, and no other files do, then a simple shell command will do the trick. For example, for *.out files:

for i in ./*.out; do mv "$i" ./."${i#./}"; done

This command will move all files in the current directory matching *.out to .<name>.out

basename is almost never necessary because simple parameter expansion can do its job. Also, for maximum safety, prefix globs with ./. for i in ./*.out; do mv "$i" ./"${i#./}"; done
–
jw013Feb 14 '12 at 21:40

@jw013 I get a syntax error with your version.
–
Andrew LambertFeb 14 '12 at 21:45

Fixed: for i in ./*.out; do mv "$i" ./."${i#./}"; done I forgot the . in the destination so it would have tried to rename a file to itself. There should be no syntax error, just a logic error in the original.
–
jw013Feb 14 '12 at 21:49

Oooo, this is cool. But can this be modified to add filenames matching a chosen file ending to a .hidden file. The scenario where that would be beneficial is in a directory containing only a .tex and its associated files that I don't need to see. I assume the compiler couldn't find the files with the dot in front, so a more practical solution seems to be to keep the filenames (which will be constant) in a .hidden file
–
JóhannFeb 14 '12 at 22:14