Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am aware that you can delete Mac OS X hidden files/folders (such as /.Spotlight-V100 or .DS_Store) on a USB drive using various scripts. But then the hidden files/folders get added again before you eject it.

Is there any way to prevent this, and if so - how?

share|improve this question
    
Are you talking about specific files? –  Oliver Salzburg May 26 '12 at 13:05
    
@OliverSalzburg the ones that OS X adds automatically. westwind.com/reference/OS-X/invisibles.html. all of them. –  gadgetmo May 26 '12 at 13:06
    
@Oliver thanks for the edit. –  gadgetmo May 26 '12 at 13:08
    
It might be helpful if you put the names of the hidden files in your question. That way people will quickly know what you mean. –  Oliver Salzburg May 26 '12 at 13:13
    
@Oliver thanks. done. –  gadgetmo May 26 '12 at 13:19

1 Answer 1

To prevent /.Spotlight files you must prevent Spotlight fron indexing external drives.

To do this for a specific drive add a file called .metadata_never_index to the root directory of the removable drive.

You can also completely prevent spotlight indexing but I figured that was not what you were looking for.

To prevent .DS_Store files from being created:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

More Info Here (And More files that you can prevent) and Here

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.