26

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.

19

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.

  • 11
    So to prevent it writing hidden files to the usb you have to create a hidden file? Sigh – Basic Nov 19 '14 at 9:23
8

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.