Name

ditto

Synopsis

    ditto [options] files directory
    ditto [options]directory1 directory2

Copies files and directories while preserving most file information, including resource fork and HFS metadata information when desired. ditto preserves the permissions, ownership, and timestamp of the source files in the copies. ditto overwrites identically named files in the target directory without prompting for confirmation.

ditto works like cp in the first synopsis form. However, the second form differs in that cp -r copies the entire directory1 into an existing directory2, while ditto copies the contents of directory1 into directory2, creating directory2 if it doesn’t already exist.

Options

-arch arch

When copying fat binary files, copy only the code for CPU type arch. Fat binary files contain different code for different CPU architectures. The -arch flag allows you to “thin” the binary by copying only the code for the specified architecture. Possible values for arch include ppc, m68k, i386, hppa, and sparc.

-bom pathname

When copying a directory, include in the copy only those items listed in BOM (Bill of Materials) file pathname. See mkbom(8), lsbom(8), and bom(5) for more information on BOM files.

-c

Create a cpio archive at directory2.

--extattr

Preserve POSIX extended attributes. This is the default.

-h, --help

Print a usage message.

-k

Specify that archives are PKZip format.

--keepParent

Embed directory1’s parent directory in directory2.

--nocache

Do not use the Mac OS X Unified Buffer ...

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.