My car stereo can use USB flash drives to play music from, so I asked about Copying MP3s from an iTunes playlist. That was all fine and dandy, except my stereo wouldn't play the MP3 files. I eventually put the flash drive into my work computer running Windows 7, and I found the issue: A bunch of hidden files starting with ._filename.mp3 were also loaded. I know in Windows you can DEL files based on attributes, and I was wondering if you can do the same in Terminal? Possible with a script that I can run with the Volume as a parameter?

link|improve this question

I had the exact same problem. If the ._ files where there, my stereo would say "Bad Media", which was totally wrong. It would play the properly named files, but complained about each ._ file. It took me a while to verify the media wasn't bad, the car stereo was! – Eric Aug 5 '11 at 17:23
But it's not the stereo's fault it sucks... Lol. I just put it in my Win7 computer to put music on at work and saw all of them: A bunch of hidden files that were 4KB each – Luke Aug 5 '11 at 17:31
The Car stereo should ignore those files. In your case they don't contain any necessary information. But it's the same problem everywhere. My DLNA media player shows these as well while browsing. – slhck Aug 5 '11 at 17:35
feedback

2 Answers

up vote 2 down vote accepted

These files are hidden in OS X because they start with . and are therefore not shown in Finder by default. There is no special attribute set in these files apart from that.

A very simplistic approach would be to delete all files that start with a dot and an underscore:

find /Volumes/<your-volume-name> -name '._*' -type f -delete

Safety note: Run that without -delete to see which files would be removed. And don't ever do this on your whole Mac HD, only on your USB drive.


For some additional information: These files are called "Resource Forks" and sometimes contain information you don't want to delete. In your use case, that should be fine though. You can permanently disable the creation of these files using BlueHarvest. There's also an app that claims to clean volumes of them, but I haven't tried it and it's beta, so use with caution: Hidden Cleaner.

link|improve this answer
Did not realize that... Good to know. I'll try that tonight when I get home, then mark your answer. Thanks – Luke Aug 5 '11 at 17:01
feedback

You can also use Automator to accomplish the same thing if the terminal scares you:

Delete ._*.mp3 in an Automator workflow.

link|improve this answer
Terminal doesn't scare me unless I do rm -rf / and press Enter :P But I would like to learn Automator, looks cool – Luke Aug 5 '11 at 17:06
Ah, yeah, that's a good idea as well. – slhck Aug 5 '11 at 17:32
Is Get Selected Finder Items useful here? – Daniel Beck Aug 5 '11 at 18:17
Not really. I was on someone else's Mac and had to work hastily. – digitxp Aug 5 '11 at 18:30
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.