Geekiness and life on the third coast

How to copy or tar files without ._ (dot underscore) files in OSX

This will not remove the damn things forever, what it will do is give you a clean copy of directory without any ._ files so you can tar or copy or do what ever with it. I’m sure OSX will put them back in just as soon as it can.

Open up a Terminal window [ Finder->Applications->Utilities->Terminal ]

If you have 10.5 type then hit enter:


If you have an earlier version of OSX type then hit enter:


Now create a clean directory type:

mkdir directory_name

Go into your new directory:

cd directory_name

Copy the files:

cp old_directory_path/* .

Now quick tar that baby or copy it before OSX stuffs those files back into it.

I have found that when you copy *.gif files this way it creates duplicate files so you will have flower.gif and flower_1.gif. Just delete the *_1.gif files. ( unless of course you have a legit file with that name. )

Now those clever folks reading this will know that you can add the line

export COPYFILE_DISABLE=true or export COPY_EXTENDED_ATTRIBUTES_DISABLED=true to your .bash_profile file in your home directory so you won’t have to retype it every time you open a terminal window.

Many thanks to OSX Considered harmful where I found this solution after hours of hunting and trying things that didn’t work. ( With out which I would be putting Linux back on my computer. )