Tell me more ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I work with hidden files all the time, but I like an uncluttered desktop. It would be nice to make files like .DS_Store, and .localized invisible just on the Desktop.

Please note I am already aware of this trusty old terminal standby:

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

Setting that flag to FALSE applies to everything in the system. My goal is to make an exception for the Desktop. Any suggestions?

share|improve this question
Do you save files on your desktop, or do you always keep it uncluttered? – Daniel Lawson Oct 6 '11 at 21:54
It's generally uncluttered (no files). – Matthew Eppelsheimer Oct 6 '11 at 22:24

4 Answers

I would suggest trying out TotalFinder. Among many other features, it gives you a shortcut to show/hide invisible files in the Finder, but it does not show invisible files on the Desktop.

It's $18, but you also get tabbed and dual-pane Finder windows, and a Visor-like Finder window that you can pop up from any app.

share|improve this answer
Thanks for the suggestion. But, if an application can do that, isn't there likely a command line interface to exploit? – Matthew Eppelsheimer Oct 7 '11 at 5:26
TotalFinder's option to show hidden files is independent of AppleShowAllFiles, so it doesn't necessarily indicate the same effect could be done via command line — but I certainly hope it can be. – joelseph Oct 7 '11 at 6:18

Although i'm unsure how to fulfill your exact request, I use this tiny widget which gives 1 button access to hide/show hidden files.

share|improve this answer
Although this doesn't answer my question, it's still handy. Thanks! – Matthew Eppelsheimer Oct 7 '11 at 5:27
chflags hidden ~/Desktop/hideme

This makes the file/folder invisible from the Finder and save/open panels. You can use {command}{shift}. to toggle visibility during save/open.

share|improve this answer
Welcome to Ask Different! Can you explain what this does? Please give more details than an one-line Terminal command. Please take a look at the FAQs for more info. Thanks. – Nathan Greenstein Oct 7 '11 at 2:42
I just tested this. If you enable Finder's "show all files" setting and run chflags hidden .DS_Store, nothing happens. – Graham Oct 7 '11 at 8:57
I confirm @Graham 's observation, it doesn't work on Mountain Lion. – Kheldar Nov 15 '12 at 11:37

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer: please explain why you're recommending it as a solution. Answers that don't explain anything will be deleted. See Good Subjective, Bad Subjective for more information.

My approach to this was to set Finder to generally show invisible files, and then explicitly set the invisible flag on files/folders on the Desktop which match certain criteria (.*, Icon, etc).

But this approach failed, as Finder then consequently not only shows files hidden because they start with a dot, but also those which have the invisible flag in their filesystem entry.

Nevertheless I post this idea to you, maybe it leads you to a solution.

# Set Finder to show all hidden files
# Only needs to be executed one time.
defaults write com.apple.finder AppleShowAllFiles ON

# Then explicitly flag certain files on the Desktop as invisible
# Run this at every login or at certain intervals (cron job)
/usr/bin/SetFile -a V ~/Desktop/.* ~/Desktop/Icon ~/Desktop/OtherPatternForHiding
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.