"What's all this crap?" she complains. You've just handed back her USB drive, now plugged into her PC.

"What?" you ask.

"On my flash drive," she says. "There are all of these...stupid files."

Are you sick of explaining why your Mac – despite being superior in every way to her PC – feels the need to leave behind a bunch of files on her USB key? Or network drive, for that matter? Stop it from happening.

Indexing, trash bins, folder positions – OS X keeps track of all these things, on every drive connected to your Mac, by creating files. These files are fine on a Mac – OS X uses them regularly, and hides them from the user. Plug a drive mainly used with Windows into a Mac, however, and in Windows you'll see a variety of useless files cluttering things up. Do you want to stop the madness? You can.

The Problem

Feel unclear what the problem is? Insert any flash drive readable by Windows – FAT, in all likelihood – into your Mac. Eject it, then insert it into a Windows computer. You'll be greeted by this nonsense:

mac trash files

What's all that crap? Well, the Spotlight and Trash folders should be obvious – they're related to indexing and deleted files, respectively. The folder ".fsevents" records file system events. It's a record of everything that happens on the drive. And the infamous "DS_store" file – not pictured above – records things like the placement of icons in Finder.

This is all useful to Macs, but in Windows it's just annoying. Why does OS X write such files to drives formatted FAT, knowing Windows users will see it as nonsense? Good question.

Your Mac creates these files basically the second you plug in a drive, so there are two things you can do - delete the files before you eject the drive or stop the Mac from creating the files. I'm going to outline some apps, starting with two that take the first approach before moving on to two that take the second.

Automatically Delete the Files Before You Eject

If you think you can remember to use them, two different application can delete all of these files when you eject. Simply add the app icon to your dock and you're ready to use it.

The first such app is Eject For Windows, which despite its name is actually a Mac program. Drag any drive you want to eject here and all of the crap files will be deleted:

junk files on mac

Another app, called HiddenCleaner, works the same way:

junk files on mac

I tested both of these apps using Mountain Lion and Windows 7 – the Mac left no ugly files that the PC could see. Because both apps work the same way, you can pretty much choose based entirely on which icon you like best. I've got to say, Hidden Cleaner wins for me on that front (it's up to you, though).

Stop The Files From Being Created

Want to stop these nonsense files from even appearing on non-Mac drives? Install BlueHarvest. This app installs as a preference pane, allowing you to configure when such files are created:

junk files on mac

There's a 30-day trial, but if you want to keep this app around you're going to need to pony up $15. If crap files on Windows drives is something you really, really care about, check out BlueHarvest.

Mostly concerned about .DS_Store files on network drives? TinkerTool, a free configuration tool, can handle that. The first screen of this app allows you to stop your Mac from leaving crap files on network drives:

mac trash files

Check that box and your Mac will stop creating such files. This program does a lot more, so read more about Tinkertool. It's not as complete as BlueHarvest – no support for USB drives – but combined with a tool like Hidden Cleaner you'll be completely set.

Cross-Platform

Getting a file from a PC to a Mac used to be a big deal – file incompatibilities were a fact of life. These days the two platforms play more-or-less nicely with each other – yet annoyances like this persist. I think OS X should be smart enough to tell when a drive is meant to be shared with Windows computers and adjust accordingly, but I want to know what you think.

Is this not nearly as big a deal as I'm making it out to be? Or do you also think something at the system level should be done to fix this? Let us know in the comments below, along with links to any other tools for solving the problem.