How to prevent USB from .fseventsd, .Trashes, .Spotlight-V100 folders and .DS_Store files?

If you're going to share an writable, external disk with other OS X systems, you can run the following command from YOUR machine to prevent .DS_Store files from appearing

touch /Volumes/your_volume_name/.metadata_never_index

then protect the file by running

chmod 444 /Volumes/your_volume_name/.metadata_never_index

This existence of this hidden file will prevent OS X Spotlight from indexing the drive so you only need to do it once unless you reformat the drive. I don't know if this works cross-platform, e.g., the dreaded thumbs.db Windows files.

Hope this helps.


I found this blog post very useful: http://blog.hostilefork.com/trashes-fseventsd-and-spotlight-v100/

basically:

To stop OS/X from doing Spotlight indexing, you need a file called .metadata_never_index in the root directory of the removable drive. To stop OS/X from making a .Trashes directory, you need to make your own file that isn't a directory and call it .Trashes To keep it from doing logging of filesystem events on the drive, you need to make a directory called .fseventsd and inside that folder put a single file named no_log. ... I don't know of any way to prevent OS/X from creating .DS_Store files, which track some preferences in each directory...

But read the blog for full information and details.