Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My car stereo can play music from USB flash drives, so I asked about copying MP3s from an iTunes playlist. That worked fine, but 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 in the format ._[filename].mp3 were also loaded.

I know that in Windows, you can delete files based on attributes, and I was wondering if you can do the same in Terminal? Possibly with a script that I can run with the Volume as a parameter?

share|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 –  Canadian 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

3 Answers 3

up vote 12 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.

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

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

Delete ._*.mp3 in an Automator workflow.

share|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 –  Canadian 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

One more solution that worked for me (MacOS 10.6.8) in terminal type:

dot_clean "<your-volume-name>"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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