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.

I have set of temp files created in my folder with .bak extensions. How can I make them hide by default in Ubuntu?

I tried adding a .hidden file with *.bak as entry in the file, but that is not working. Any help is very appreciated...

share|improve this question
1  
IMO you're trying to fix the problem at the wrong end. If a program creates lots of backup files, it should put them in a dedicated folder and not spam them somewhere else. –  htorque Nov 6 '10 at 13:55
    
i have a shared dropbox folder where the backup files are getting created by another shared user. So i cant change it at that end. Need to fix at my end... –  james Nov 6 '10 at 14:05
add comment

5 Answers 5

I found this post (ubuntu forums). I hope this can help you. http://ubuntuforums.org/showthread.php?t=789684

share|improve this answer
add comment

If you place a full stop (or period) at the beginning of the name of the file it should hide it, for example:

.helloworld.txt

To view your now hidden file, click "view" on Nautilus then check "Show Hidden Files".

share|improve this answer
1  
Thank you for the tip. But they are created by a program, i cant rename each of them. –  james Nov 6 '10 at 14:04
add comment

You could also create a file called .hidden in your home directory.

Then in this file you can put the names of all the files that you would like to be hidden. One per line.

Thanks Chris

share|improve this answer
add comment

If the program and you don't care about the name of the file try this "script"

for annoyingbak in *.bak;do mv "$annoyingbak" ."$annoyingbak";done

then run it whenever you're annoyed by the .baks. It moves every file named bla.bak to .bla.bak . If you have to do it very often just

alias deannoy='for annoyingbak in *.bak;do mv "$annoyingbak" ."$annoyingbak";done'>> ~/.bashrc && . .bashrc

then you can just type deannoy in your Dropbox folder and they're gone.

Edited according to the "Bash Pitfalls" comment.

share|improve this answer
    
I suggest you read Bash Pitfalls points 1 and 2. –  htorque Nov 6 '10 at 15:03
    
oh hehe... I just use bash for the things I need in everyday tasks I (obv.) never really learned it. Good advice thanks! mv *.bak *.bak~ is the better way anyway –  turbo Nov 6 '10 at 16:07
add comment

Here's a little script I wrote for hiding LaTeX intermediate files:

alias hidetex='ls *?(aux|bbl|blg|brf|lof|log|lot|out|toc) -1 > .hidden'

I added it to the ~/.bash_aliases file, so now I just cd to the folder I want to hide the files, and type hidetex.

This is intended to be executed at specific folders, but you could make it more generic (e.g. for .bak files) and change it to perform the task recursively, adding a .hidden file to each folder, but that's a little more complicated.

share|improve this answer
add comment

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.