At work, we all use Macs, and have an SMB fileserver set up.

Somehow, weird hidden files have been popping up, particularly when syncing between our Macs and the fileserver. I don't what creates them and why they are created. For a file called index.html, a hidden file called .index.html gets created. Sometimes all the files in a folder have . equivalents, e.g. bear.jpg would also exists as a hidden file calld ._bear.jpg.

Now, these hidden files are not a problem, until you start copying folders, or do rar/zip operations, or work on a version control system. You don't want those hidden files to be cluttering up the system.

Who knows why these files are here, and possibly a command to get rid of these files from a folder recursively?

This is an example: the third file, ._index.html, was created by something, and I don't know what or why.

total 16
drwx------   7 wolfr  staff   238 Dec  9 13:34 .
drwx------   5 wolfr  staff   170 Dec  9 13:17 ..
-rwx------   1 wolfr  staff  4096 Dec  9 13:34 ._index.html
drwx------  14 wolfr  staff   476 Dec  9 13:27 css
drwx------   6 wolfr  staff   204 Dec  9 13:27 images
-rwx------@  1 wolfr  staff  3520 Dec  9 13:34 index.html
drwx------   4 wolfr  staff   136 Dec  9 13:27 js

This is a command I would use to delete .svn files recursively, how I modify it to remove files that match ._* recursively?

find . -type d -name '.svn' -print0 | xargs -0 rm -rdf

EDIT: the command is, I guess

find . -name '._*' -print0 | xargs -0 rm -rdf

That's MacOS storing its metadata. When its on a regular Mac (HFS) filesystem, these are stored in the file's properties by the filesystem itself. But in FAT or SMB there is no space reserved for this, so OS X works around it and creates the ._ file...

This command would recursively remove them:

find . -type f -name '._*' -delete
| improve this answer | |
  • +1: This is exactly what OSX does. There really isn't any way around it. – Satanicpuppy Dec 9 '09 at 15:19
  • Shouldn't there be an option to mount that turns this of? – Wim Dec 9 '09 at 15:21
  • +1 Good explanation. Curious about a workaround too. – Maxwell Dec 9 '09 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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