ClearDisk
Buy for $10Download ClearDiskDownload
A LITTLE MORE CLARITY

How to remove ._ files and hidden Mac files from a USB drive

To clean hidden Mac files off a USB drive or SD card, empty the Trash while the drive is connected to clear .Trashes, exclude the volume in Spotlight Privacy to stop .Spotlight-V100 indexing, and run dot_clean -m /Volumes/NAME in Terminal to remove ._ AppleDouble files before ejecting.

What the hidden files are

A Mac treats a USB stick or memory card like any other disk, so it adds the same housekeeping files it keeps on its own drives. Their names start with a dot, which hides them on the Mac, but Windows PCs, TVs, cameras and car stereos often show them or try to open them.

None of them harms the files you copied, and apart from .Trashes, which holds whatever you deleted, they are usually small. The steps below deal with them in order of how much difference they make.

  • .Spotlight-V100: the Spotlight index for that drive, so its files show up in searches.
  • .fseventsd: a log of file-system changes on the drive, kept for macOS services that watch for changes.
  • .Trashes: the drive’s own Trash. Anything you delete from the drive in Finder waits here, using the drive’s space, until you empty the Trash.
  • ._ files, such as ._photo.jpg: AppleDouble files holding Mac metadata, such as extended attributes and Finder information, on formats that can’t store it natively, including ExFAT and FAT32.
  • .DS_Store: the Finder’s view settings for each folder you open.

1. Empty the Trash before you eject

Files deleted from a removable drive go to .Trashes on that drive, not to your Mac, and they are emptied only while the drive is connected. Before ejecting, open the Trash in the Dock, check what is there and empty it. Or skip the Trash for files on the drive: select them and press Option-Command-Delete to delete them immediately, once you’re sure you don’t need them.

This is the step that recovers real space. A card that still seems full after you deleted photos in Finder often has them waiting in .Trashes.

2. Exclude the drive from Spotlight

With the drive connected, open System Settings, click Spotlight in the sidebar, then click Search Privacy and add the drive with the add button (+), or drag it into the list. That is the path in macOS 15 and later; in macOS 13 and 14 it is Siri & Spotlight → Spotlight Privacy. Spotlight stops indexing the drive, and its files no longer appear in searches.

In Terminal, mdutil does the same. The first command turns indexing off for the volume, the second shows its status, and the third removes the existing index folder; its manual page notes that removing the index doesn’t disable indexing by itself, so run it after the first. Replace NAME with the drive’s name as it appears in /Volumes, in quotes if it contains spaces. macOS may still keep a small .Spotlight-V100 folder that records the setting for that drive.

sudo mdutil -i off /Volumes/NAME
mdutil -s /Volumes/NAME
sudo mdutil -X /Volumes/NAME

3. Clean up ._ files with dot_clean

On ExFAT and FAT32 drives, a file copied from a Mac can get a ._ companion. macOS includes dot_clean for these. With -n it deletes only the ._ files whose matching file no longer exists; with -m it deletes all of them. Run it just before ejecting, when you’re done copying.

What you lose with -m is the Mac-only information those files carried, such as Finder tags, for the copies on that drive. The originals on your Mac are untouched. If you want the drive to keep that metadata, format it as APFS or Mac OS Extended, which store it natively, though other devices may not be able to read those formats.

dot_clean -n /Volumes/NAME
dot_clean -m /Volumes/NAME

What you can’t switch off

macOS has no documented setting to stop .fseventsd on removable drives, and Apple documents its .DS_Store setting for network shares only. Instructions online that promise to stop everything rely on undocumented tricks that can change between macOS releases. The practical approach is the routine above: empty, exclude, clean, eject.

If a device needs a completely clean card, as some cameras and car stereos do, the reliable fix is to copy off anything you want to keep and let that device format the card itself. The .DS_Store guide covers those files in more detail.

4. Eject properly

Drag the drive to the Trash in the Dock, click the eject button beside it in the Finder sidebar, or select it and choose File → Eject, then wait until it disappears from Finder before unplugging. Ejecting lets macOS finish writing, including its housekeeping files, so a drive pulled out early is at more risk than one that simply has a few hidden files.

If the Mac says the drive is in use, quit the app that has a file open on it. The eject guide covers the stubborn cases.

Common questions

How do I stop my Mac from putting hidden files on a USB drive?

You can only reduce them, not switch them all off, since macOS has no documented setting that stops every hidden file on removable drives. Exclude the drive from Spotlight, empty its Trash before ejecting, run dot_clean on ExFAT or FAT32 drives, and eject properly.

What is the .Trashes folder on a USB drive?

It's the drive's own Trash, and anything you delete from the drive in Finder waits there, using the drive's space, until you empty it while the drive is still connected. Emptying it before ejecting is the step that actually recovers space, since a card can still seem full after you delete photos.

What are the ._ files that appear on my USB drive?

They're AppleDouble files holding Mac metadata, such as extended attributes and Finder information, for file systems like ExFAT and FAT32 that can't store that data natively. Running dot_clean with -m before ejecting removes them, though you lose that Mac-only metadata for the copies on the drive.

How do I exclude a USB drive from Spotlight on Mac?

With the drive connected, open System Settings, then Spotlight, then Search Privacy, and add the drive with the add button, or drag it into the list. In Terminal, mdutil -i off for the volume does the same thing, so Spotlight stops indexing the drive.

References & further reading

These guides combine the linked official guidance with ClearDisk’s documented behavior. Your files and app settings determine the right next step.

Main guide: how to delete files on Mac · Related pillar: how to show hidden files on Mac · Browse all Trash & files guides →

FROM A NUMBER TO AN ANSWER

See what’s using
your space.

Explore your Mac with ClearDisk’s free local scanner.
Review the files. Keep the control.

Download free scannermacOS 15+ · version 2.2.1Cleanup license: $10 once