How to copy files to an SD Card without macOS metadata files?

I regularly copy firmware for a 3D printer to SD cards. I format the drive and copy the same set of files to each SD card, and the macOS metadata specific files always go with it (.fseventsd,.spotlight-V100, etc).

Is there a way in macOS or with 3rd party software that I can format the drive and copy the file system over without those files? I plan to do this for about 20 SD cards at a time so a single click or easily repeatable option is preferable.

I'm using Mojave if that makes a difference.


Solution 1:

These days most systems ought to be smart enough to simply ignore them if they don't know what they are.

macOS will put those 3 files [& more in some circumstances] on every disk it ever sees, whether you want it to or not. There is, as far as I'm aware, no way to prevent this - all you can do is try to delete them right before ejecting the disk.

There's a bash script on Superuser - How do I keep Mac OS X from saving hidden files on my flash drive? which would appear to do this, though idk how many times you are going to have to authorise the sudo command; hopefully once per session not once per disk.

Personally, I invested in the paid alternative, BlueHarvest, which does the same thing in a 'set & forget' manner & is customisable for different drive types & purposes..

Built-in support for deleting: .DS_Store, ._AppleDouble, .apdisk, .AppleDouble (folders via smb), .com.apple.timemachine.donotpresent, .fseventsd, .Spotlight-V100, .TemporaryItems, .VolumeIcon.icns, $Recycle.bin, Desktop.ini, Icon?, Thumbs.db