read

The Problem

Creating tar files on a Mac results in a ._* meta file for each file.

To Solution

To remove these files, cd to the extracted archive and:

find . -name ""._*"" -print0 | xargs -0 rm -rf

This will find any files that match the pattern ._*. Each file is then piped to xargs -0 rm -rf. The -0 flag is important because this makes sure that files with spaces are also deleted.

To quote the xargs man page:

--null, -0 Input items are terminated by a null character instead of by whitespace, and the quotes and backslash are not special (every character is taken literally). Disables the end of file string, which is treated like any other argument. Useful when input items might contain white space, quote marks, or backslashes. The GNU find -print0 option produces input suitable for this mode.

Blog Logo

Phil Birnie


Published

Image

Phil Birnie

Full Stack Web Developer from Columbus, Ohio

Back to Overview