Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Usually Linux programs store user's settings in ~/.* directories. But unfortunately some developers (of some applications I need) do not follow this rule and don't start their settings storage folders names with a dot. This results in never-user-used folders cluttering (not the right word perhaps, as there are not many, but they annoy anyway) a home directory. Renaming them is not an option, as the applications won't find them in this case (and will create them again).

Is there a way to hide a folder having no dot starting its name from being displayed in common file system browsers (I actually use Thunar of XFCE, alongside with Midnight Commander and Krusader, but wouldn't mind to know about Nautilus too).

share|improve this question

2 Answers 2

up vote 16 down vote accepted

Nautilus (This doesn't work with Thunar unfortunately, see this bug report) will hide any file or folder that is listed in the file .hidden located in the same directory.

There are two ways to hide a folder in Nautilus:

Nautilus script

  1. Save the following code in a new file in your home folder. Name it Hide.
    #!/usr/bin/env python

    import commands
    from os.path import join


    files = commands.getoutput("echo $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS")
    cwd = commands.getoutput("echo $NAUTILUS_SCRIPT_CURRENT_URI")
    cwd = cwd[7:]

    for f in files.split(" /"):

        f = f.split("/")[-1]

        commands.getoutput("echo "+f+" >> "+join(cwd, ".hidden"))
  1. Run the following commands to install the script:

    cp Hide ~/.gnome2/nautilus-scripts/`  
    chmod u+x ~/.gnome2/nautilus-scripts/Hide`
    
  2. In Nautilus, select one or more files/folders and right click. Select Hide from the Scripts menu:

    enter image description here

    Reload the current location ( F5 ) and the selected files/folders will be hidden.

Command line

Say you want to hide a folder called "Rick Astley's Greatest Hits", just run the following command:

echo "Rick Astley's Greatest Hits" >> .hidden
share|improve this answer
2  
Exactly a kind of answer I wished to get. But, unfortunately, doesn't work for Thunar. –  Ivan Dec 22 '10 at 2:42
    
@Ivan, Hopefully they will add it eventually, see the bug report I linked to in my answer. –  Alvin Row Dec 22 '10 at 2:50
    
Why double quotes "ObnoxiousFolder"?? –  karthick87 Dec 22 '10 at 8:17
    
FYI, the bug report was closed as WONTFIX (rather rudely IMO, since there was a patch for it already, and the project maintainer basically said "I don't care"). We will need another solution... –  waldir Jan 7 '13 at 17:46
    
Recent version of Thunar support this as they use GIO to determine hidden directories, and GIO now implements support for the .hidden file. –  Brian Campbell Jul 11 at 14:59

Open synaptic and search for "nautilus-hide" install it. Logout and login. Now right click on any file or folder. You will now see a "Hide" option in the Context Menu.

It will not modify the name but hide the folder.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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