How do I remove _. on my files when copying from mac to flash drive?

Every time I copy a file from my mac to a flash drive and open it in other laptops, a duplicate file with _. appears. How do I remove it?

MacBook Pro 13″, macOS 14.0

Posted on Dec 6, 2023 6:24 PM

Reply
Question marked as Top-ranking reply

Posted on Dec 6, 2023 7:25 PM

Background


Those aren't duplicate files – they're small files containing metadata. The Finder is trying to transparently preserve Mac filesystem metadata that's not present in filesystems like FAT32. If you copy back the other way, from the flash drive to the Mac, it would recombine those files with the main ones.


Unfortunately, the metadata files confuse many non-Mac devices, which think they are corrupt MP3s, corrupt JPGs, etc. Even Macs don't really need the ._ metadata for things like MP3 and JPG files. If you get rid of the ._ metadata and copy the main MP3 or JPG file back to a Mac, the Mac will work with the main file just fine.


Still, the Finder insists on creating these little "turds".



To clean them off a USB drive


Set up Finder Settings so that USB flash drives show up on the Desktop. (This is so you can drag and drop the USB drive icon, instead of having to know how to type the drive's Unix directory name.)


After preparing a USB flash drive, and just before ejecting it, go into the Terminal. Type


dot_clean -m


and a trailing space, but do not press RETURN. Drag the USB drive icon from the Desktop into the Terminal window (so the Mac will type the drive's directory name for you, completing the command).


Press RETURN to issue the command, then immediately eject the USB flash drive (in the Finder) – before the Finder gets the idea to write more "turds".


You can make this more convenient with Automator, so you can do everything from the Finder without going into the Terminal. Same basic idea, just packaged up a bit more neatly.

1 reply
Question marked as Top-ranking reply

Dec 6, 2023 7:25 PM in response to borealis_

Background


Those aren't duplicate files – they're small files containing metadata. The Finder is trying to transparently preserve Mac filesystem metadata that's not present in filesystems like FAT32. If you copy back the other way, from the flash drive to the Mac, it would recombine those files with the main ones.


Unfortunately, the metadata files confuse many non-Mac devices, which think they are corrupt MP3s, corrupt JPGs, etc. Even Macs don't really need the ._ metadata for things like MP3 and JPG files. If you get rid of the ._ metadata and copy the main MP3 or JPG file back to a Mac, the Mac will work with the main file just fine.


Still, the Finder insists on creating these little "turds".



To clean them off a USB drive


Set up Finder Settings so that USB flash drives show up on the Desktop. (This is so you can drag and drop the USB drive icon, instead of having to know how to type the drive's Unix directory name.)


After preparing a USB flash drive, and just before ejecting it, go into the Terminal. Type


dot_clean -m


and a trailing space, but do not press RETURN. Drag the USB drive icon from the Desktop into the Terminal window (so the Mac will type the drive's directory name for you, completing the command).


Press RETURN to issue the command, then immediately eject the USB flash drive (in the Finder) – before the Finder gets the idea to write more "turds".


You can make this more convenient with Automator, so you can do everything from the Finder without going into the Terminal. Same basic idea, just packaged up a bit more neatly.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I remove _. on my files when copying from mac to flash drive?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.