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

44,279

Solution 1

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.

Solution 2

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.

Share:
44,279
static
Author by

static

Updated on September 18, 2022

Comments

  • static
    static over 1 year

    If you give somebody your USB drive to put files on it, it is so annoying to clean up afterwards, all these useless for other than OSX platforms artifacts, which pollute the disk. Is it any solution to prevent this behavior. Maybe to write those files on your own and set them as read only something like "6/700" permissions?

    P.S. I'm not asking what to do on OSX by others, since I don't know who will put me a new file next time (I can't explain this problem and any configurations to all other people), but rather what to do from the USB drive point of view.

  • Basic
    Basic over 9 years
    So to prevent it writing hidden files to the usb you have to create a hidden file? Sigh
  • mwfearnley
    mwfearnley over 4 years
    What benefit is chmod 444? It may prevent writes to it, but it won't prevent its deletion, and you probably don't care about its contents. Whether Unix permissions will work on the USB stick's file system is also up for debate.