Problem with Music Files on USB Drives

For years I have had a USB stick in my car loaded with mp3 files which worked perfectly. A couple of days ago I refreshed this USB drive with some new music using Finder on an Apple Silicone MBP and all heck broke loose. I erased the drive using Disk Utility and then copied the mp3s to the drive using Finder. Lo and behold the car then started to "say" that every other file was unplayable. I tried the stick on a music system at home, same issue, every other file unplayable. I then tried a different USB drive, same issue. Long story but the problem is that macOS places a duplicate named copy of every file in the USB drive with the prefix ._ and the extension .mp3 (even though they are not mp3s) and to make matters worse the files are hidden in macOS. Command + Shift + . will NOT show the hidden files on a Mac however (thanks for Windows) two Windows PCs, one W10 and the other W11, both display the hidden files. So there are hidden files on a Mac that that are not visible even if I do the Command + Shift + . Not good!!!


I cannot take a screenshot of these files on the Mac as the files do not show. However I took a screenshot on much maligned Windows and they can be seen below. These appear for every single album that I have copied so deleting them manually would not work as I have hundreds. And please note that this was not an issue in the past but I don't recall when I last refreshed that USB drive, it's been awhile. My research shows that this has been going on for awhile but it had not bitten me yet.


So is there something I can do while copying to avoid corrupting my USB drives with these hidden mac files that play havoc on other systems, cars, home stereos, etc?


As an example, using a Windows computer to display an album one can see 11 hidden files (not visible on a Mac even with hidden files "showing"), all mp3s, all 4KBs, and somehow placed there by macOS after copying the real 11 music files. The cars and the home stereos try to play these files but are unable and display an error. Any ideas on how to avoid this? I found an app called BlueHarvest that removes these files, the issue is know, is that the only way?




I tried running a batch file on a USB drive in W11 in an attempt to delete these files but was unsuccessful. Here is what I tried:


D:

cd D:\

del /s /q ._*.*


Thanks for any help.


Posted on Jul 22, 2023 6:16 PM

Reply
Question marked as Top-ranking reply

Posted on Jul 23, 2023 7:41 PM

elcpu wrote:

I erased the drive using Disk Utility and then copied the mp3s to the drive using Finder. Lo and behold the car then started to "say" that every other file was unplayable. I tried the stick on a music system at home, same issue, every other file unplayable. I then tried a different USB drive, same issue. Long story but the problem is that macOS places a duplicate named copy of every file in the USB drive with the prefix ._ and the extension .mp3 (even though they are not mp3s) and to make matters worse the files are hidden in macOS.


The Finder sees that the external drive does not use a Mac filesystem. It is trying to preserve some extended attributes that a Mac filesystem would maintain, by creating


  • FOO.MP3 – the main file
  • ._FOO.MP3 – the extended attribute file


The idea being that if you ever copy files back to the Mac, it can transparently combine the data from these two files, to preserve the extended attributes.


macOS is based on Unix, and adding a leading '.' (s a standard Unix convention for hiding a file from regular directory listings. The ._FOO.MP3 name represents an attempt to create a hidden file with a unique name that is easy to associate with the main file.


Unfortunately, other systems don't know about the Finder's "._" games, and may not even know about the Unix convention for hiding a file by starting its name with a "." They see the .MP3 suffix, conclude that the extended attribute files are MP3 files, and of course, then discover that these "MP3" files are hopelessly corrupt.


The same issue happens with preparing thumb drives and memory cards for use with HDTVs and digital picture frames. The ._*.JPG files look like corrupt JPG photos to many third-party devices.


The solution is to go into Terminal just before you eject a memory card or USB flash drive.

  1. Go to that volume. (E.g., type cd and a space, then drag-and-drop the memory card or USB flash drive icon.)
  2. Do a rm ._*.* to get rid of all files with a leading ._
  3. Do a ls -a to identify any remaining files that begin with a .
  4. Do a rm on any such files other than . or .. (in Unix, . means the current directory and .. is the parent directory)
  5. In the Finder, eject the memory card or flash drive without doing anything else first.


For a MP3 or JPG file, you don't lose all that much by trashing the extended attributes file – even if you do decide to later copy the file back to the Mac.

Similar questions

45 replies

Jul 24, 2023 6:55 AM in response to Servant of Cats

FYI... With big help from Barney-15E and MrHoffman (here and in the Lounge) I have created a Shortcut to delete all ._ files and all .DS_Store files and it works well from the Menu Bar. In order to verify I have to move the drive to the much maligned Windows which does show ALL hidden files in contrast to macOS which only shows some, grrr....


Jul 23, 2023 10:20 AM in response to elcpu

rm "/Volumes/USB Music/.DS_Store"

That needs to go before you eject it.


-m deletes the metadata files instead of trying to merge them which can’t be done on that file system. Apple stores the metadata with the file. On file systems that can’t do that, it splits them out as ._ files. If you copy back to a Mac file system, it would automatically merge them into the copied file.

Jul 22, 2023 6:39 PM in response to Barney-15E

I have never installed BlueHarvest. In hindsight this is how I think I avoided the issue. I had an older MBP (2014) but also a W10 computer. I kept my music library in the W10 PC prior to buying this M1 MBP in late 2021 and then moved the music library to the new MBP. So I likely avoid it by going from W10 to USB and have not likely refreshed the car's drive since late 2021. Now with the new Mac, grrr...


I am going to try your Terminal command and see. I have to run it and then connect the drive to a Windows PC to see if the files are gone. There are also redundant junk like DS_Store files and others but they do not seem to be an issue. Will get back here in a bit and let you know, thanks!!!

Jul 22, 2023 6:42 PM in response to elcpu

You can delete the .DS_Store file and if you don't sort or do any other manipulate with the Finder, it should not write that back to the drive. It stores the information on how you want to display the folder in the Finder. If you don't alter the default view, it should not write another file.

You'll still have .Trashes and maybe a .Spotlight-V100.

Jul 22, 2023 8:54 PM in response to Barney-15E

This is above my pay grade so I don't quite follow. Are you saying that I can use your whole script as-is above and just change the first line to args = ("mini64")? Does not seem right to me so would you please clarify?


i.e., If I want to create a shortcut to clean and eject a USB drive named mini64 after copying music files into it what would I specifically include in the shortcut?

Jul 23, 2023 11:08 AM in response to tbirdvet

tbirdvet wrote:
I put music on my thumb drive to use in my car all the time. What I do is have the drive formatted to fat32 then I open music, copy the songs then paste into the drive. No issues.


That is how it used to work for me using a PC to copy the files but that is no longer the case using a Mac. It does not work on my 2018 Honda CR-V with a fancy head unit or my home music systems as they try to read the hidden .mp3 files. However my wife's very old CR-V (2010) does work even with those junk files, the head unit skips them although the display shows a wrong song count. Deleting the ._ mp3 hidden files takes care of the issue for my newer CR-V and the home music systems. What car do you have?

Jul 23, 2023 11:35 AM in response to elcpu

elcpu wrote:
Barney-15E wrote:
rm "/Volumes/USB Music/.DS_Store"
That needs to go before you eject it.

That did not work, the .DS_Store files are still there. Should it be:
rm "/Volumes/USB Music/".DS_Store


Or: rm .DS_Store "Volumes/USB Music/"


There is a .DS_Store file in every single album I am copying, not just at the root of the USB drive. The command would have to find ALL of them on the drive.

Jul 23, 2023 4:34 PM in response to elcpu

What did they delete? I cannot tell from what is left.

I had a post with a scrap of a command which would have deleted the contents of the USB stick. Using the command line can be dangerous. You can be half-way through typing a command and accidentally hit return. Sometimes, that can do destructive things.


I think you had a comment about the app being able to recursively delete the .DS_Store files.

I'm not sure there was any more than that.

Jul 24, 2023 7:04 AM in response to Servant of Cats

Servant of Cats wrote:

That's just part of the prompt, to let you know that the shell is waiting for you to type in another command. The bash shell ("Bourne Again Shell"; the name is a pun) uses "$"; other shells like csh might use "%".


You lost me there... Care to elaborate?

I am using zsh because that is what Barney used, does it make any difference?

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.

Problem with Music Files on USB Drives

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