Manual Pages for UNIX Darwin command on man ditto
MyWebUniversity

Manual Pages for UNIX Darwin command on man ditto

DITTO(1) BSD General Commands Manual DITTO(1)

NAME

ddiittttoo - copy directory hierarchies, create and extract archives

SYNOPSIS

ddiittttoo [-vv] [-VV] [-XX] [] src ... dstdirectory

ddiittttoo [-vv] [-VV] [] srcfile dstfile

ddiittttoo -cc [-zz | -jj | -kk] [-vv] [-VV] [-XX] [] src dstarchive

ddiittttoo -xx [-zz | -jj | -kk] [-vv] [-VV] [] srcarchive ...

dstdirectory

ddiittttoo -hh | --hheellpp

DESCRIPTION

In its first form, ddiittttoo copies one or more source files or directories to a destination directory. If the destination directory does not exist it will be created before the first source is copied. If the destination directory already exists then the source directories are merged with the previous contents of the destination.

In its second form, ddiittttoo copies a file to the supplied dstfile path-

name.

The next two forms reflect ddiittttoo's ability to create and extract ar-

chives. These archives can be either CPIO format (preferred for unix content) or PKZip (for Windows compatibility). srcarchive (and

dstarchive) can be the single character '-', causing ditto to read

(write) archive data from stdin (or to stdout, respectively). ddiittttoo follows symbolic links provided as arguments but does not follow any links as it traverses the source or destination hierarchies. ddiittttoo overwrites existing files, symbolic links, and devices in the destination when these are copied from a source. The resulting files, links, and devices will have the same mode, access time, modification time, owner,

and group as the source items from which they are copied. Pipes, sock-

ets, and files with names beginning with .nfs or .afpDeleted will be ignored. ddiittttoo does not modify the mode, owner, group, extended attributes, or ACLs of existing directories in the destination. Files

and symbolic links cannot overwrite directories or vice-versa.

ddiittttoo can be used to "thin" Universal Mach-O binaries during a copy.

ddiittttoo can also copy files selectively based on the contents of a BOM ("Bill of Materials") file. ddiittttoo preserves hard links present in the source directories and preserves setuid and setgid modes when run as the superuser.

ddiittttoo will preserve resource forks and HFS meta-data information when

copying unless instructed otherwise using --nnoorrssrrcc . Similarly, ddiittttoo

will preserve extended attributes and Access Control Lists (ACLs) unless

--nnooeexxttaattttrr or --nnooaaccll is passed. DITTONORSRC can be set in the environ-

ment as an alias to --nnoorrssrrcc --nnooeexxttaattttrr --nnooaaccll on the command line.

OOPPTTIIOONNSS

-hh print full usage

-vv print a line of output to stderr for each source directory

copied.

-VV print a line of output to stderr for every file, symbolic

link, and device copied.

-XX when copying one or more source directories, do not descend

into directories that have a different device ID.

-cc create an archive at the destination path. The default

format is CPIO, unless -kk is given. CPIO archives should

be stored in files with names ending in .cpio. Compressed CPIO archives should be stored in files with names ending in .cpgz.

-zz create compressed CPIO archives, using gzip(1) compression.

-jj create compressed CPIO archives, using bzip2(1) compres-

sion.

-xx extract the archives given as source arguments. The format

is assumed to be CPIO, unless -kk is given. Compressed CPIO

is automatically handled.

-kk create or extract from a PKZip archive instead of the

default CPIO. PKZip archives should be stored in filenames ending in .zip.

--kkeeeeppPPaarreenntt when creating an archive, embed the parent directory name

src in dstarchive.

--aarrcchh arch Thin Universal binaries to the specified architecture. If

multiple --aarrcchh options are specified then the resulting

destination file will contain each of the specified archi-

tectures (if they are present in the source file). arch should be specified as "ppc", "ppc64", "i386", etc.

--bboomm bom copy only files, links, devices, and directories that are

present in the specified BOM.

--rrssrrcc preserve resource forks and HFS meta-data. ddiittttoo will

store this data in Carbon-compatible . AppleDouble files

on filesystems that do not natively support resource forks.

As of Mac OS X 10.4, --rrssrrcc is default behavior.

--nnoorrssrrcc do not preserve resource forks and HFS meta-data. If both

--nnoorrssrrcc and --rrssrrcc are passed, whichever is passed last

will take precedence. Both options override DITTONORSRC.

Unless explicitly specified, --nnoorrssrrcc also implies

--nnooeexxttaattttrr and --nnooaaccll to match the behavior of Mac OS X

10.4.

--eexxttaattttrr preserve extended attributes (requires --rrssrrcc). As of Mac

OS X 10.5, --eexxttaattttrr is the default.

--nnooeexxttaattttrr do not preserve extended attributes.

--qqttnn preserve quarantine information. As of Mac OS X 10.5,

--qqttnn is the default.

--nnooqqttnn do not preserve quarantine information.

--aaccll preserve Access Control Lists (ACLs). As of Mac OS X 10.5,

--aaccll is the default.

--nnooaaccll do not preserve ACLs.

--sseeqquueesstteerrRRssrrcc

when creating a PKZip archive, preserve resource forks and

HFS meta-data in the subdirectory MACOSX. PKZip extrac-

tion will automatically find these resources.

--nnooccaacchhee do not perform copies using the Mac OS X Unified Buffer

Cache. Files read and written will not be cached, although if the file is already present in the cache, the cached information will be used. EEXXAAMMPPLLEESS The command:

ditto srcdirectory dstdirectory

copies the contents of srcdirectory into dstdirectory, creating dstdirectory if it does not already exist. The command:

ditto srcdirectory dir/dstdirectory

copies the contents of srcdirectory into dir/dstdirectory, creating dir and dstdirectory if they don't already exist. The command:

ditto src-1 ... src-n dstdirectory

copies the contents of all of the src directories into dstdirectory, creating dstdirectory if it does not already exist. The command:

ditto -arch ppc universalfile thinfile

copies the contents of universalfile into thinfile, thinning executable

code to ppc-only on the fly.

The command:

ditto -c -norsrc Scripts -|ssh rhost ditto -x -norsrc - ./Scripts

copies Scripts, skipping any resources or meta-data, to rhost.

The command:

pax -f archive.cpio

will list the files in the CPIO archive archive.cpio. The command:

pax -zf archive.cpgz

will list the files in the compressed CPIO archive archive.cpgz. The command:

ditto -c -k -sequesterRsrc -keepParent srcdirectory archive.zip

will create a PKZip archive similarly to the Finder's Compress function-

ality. The command:

unzip -l archive.zip

will list the files in the PKZip archive archive.zip. EERRRROORRSS

ddiittttoo returns 0 if everything is copied, otherwise non-zero. ddiittttoo

almost never gives up, preferring to report errors along the way. Diag-

nostic messages will be printed to standard error. ENVIRONMENT DITTOABORT If the environment variable DITTOABORT is set, ddiittttoo will call abort(3) if it encounters a fatal error. DITTONORSRC

If DITTONORSRC is set but --rrssrrcc, --eexxttaattttrr, and --aaccll are

not specified, ddiittttoo will not preserve those additional types of metadata.

BUGS

ddiittttoo doesn't copy directories into directories in the same way as cp(1). In particular,

ditto foo bar

will copy the contents of foo into bar, whereas

cp -r foo bar

copies foo itself into bar. Though this is not a bug, some may consider

this bug-like behavior. --kkeeeeppPPaarreenntt for non-archive copies will eventu-

ally alleviate this problem.

SEE ALSO

bom(5), lsbom(8), mkbom(8), cpio(1), zip(1), gzip(1), bzip2(1), tar(1). Mac OS X May 8, 2007 Mac OS X




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™