Merge from vendor branch LIBARCHIVE:
[dragonfly.git] / bin / cpdup / cpdup.1
1 .\" (c) Copyright 1997-1999 by Matthew Dillon and Dima Ruban.  Permission to
2 .\"    use and distribute based on the DragonFly copyright.  Supplied as-is,
3 .\"    USE WITH EXTREME CAUTION.
4 .\"
5 .\"
6 .\" $DragonFly: src/bin/cpdup/cpdup.1,v 1.7 2004/10/31 00:43:14 liamfoy Exp $
7 .Dd October 28, 1999
8 .Dt CPDUP 1
9 .Os BSD 4
10 .Sh NAME
11 .Nm cpdup
12 .Nd mirror filesystems
13 .Sh SYNOPSIS
14 .Nm cpdup
15 .Op Fl v[vv..]
16 .Op Fl u
17 .Op Fl I
18 .Op Fl f
19 .Op Fl s0
20 .Op Fl i0
21 .Op Fl q
22 .Op Fl o
23 .Op Fl m
24 .Oo
25 .Fl M
26 .Ar file
27 .Oc
28 .Oo
29 .Fl X
30 .Ar file
31 .Oc
32 .Op Fl x
33 .Ar source_dir
34 .Ar target_dir
35 .Sh DESCRIPTION
36 The 
37 .Nm
38 utility makes an exact mirror copy of the source in the destination, creating
39 and deleting files and directories as necessary.  UTimes, hardlinks, 
40 softlinks, devices, permissions, and flags are mirrored.  By default,
41 .Nm
42 asks for confirmation if any file or directory needs to be removed from
43 the destination and does not copy files which it believes to have already
44 been synchronized (by observing that the source and destination file's size 
45 and mtimes match).
46 .Nm
47 does not cross mount points in either the source or the destination.
48 As a safety measure,
49 .Nm
50 refuses to replace a destination directory with a file.
51 .Pp
52 The following options are available:
53 .Bl -tag -width flag
54 .It Fl v[vv]
55 Set verboseness.  By default
56 .Nm
57 does not report its progress except when asking for confirmation.  A single
58 .Fl v
59 will only report modifications made to the destination.
60 .Fl vv
61 will report directories as they are being traversed as well as 
62 modifications made to the destination.
63 .Fl vvv
64 will cause all files and directories to be reported whether or not
65 modifications are made.
66 .It Fl u
67 Causes the ouptut generated by
68 .Fl v[vv]
69 to be unbuffered.
70 This can be useful for obtaining prompt progress updates through a pipe.
71 .It Fl I
72 will cause cpdup to print a summary at the end with performance counter.
73 .It Fl f
74 Forces file updates to occur even if the files appear to be the same.
75 .It Fl s0
76 Disable the disallow-file-replaces-directory safety feature.  This
77 safety feature is enabled by default to prevent user mistakes from blowing
78 away everything accidently.
79 .It Fl i0
80 Do not request confirmation when removing something.
81 .It Fl q
82 Quiet operation
83 .It Fl o
84 Do not remove any files, just overwrite/add.
85 .It Fl m
86 Generate and maintain an MD5 checkfile in each directory on the source
87 and do an MD5 check on each file of the destination when the destination
88 appears to be the same as the source.  If the check fails, 
89 .Nm
90 the source is recopied to the destination.  When you specify a destination
91 directory the MD5 checkfile is only updated as needed and may not be updated
92 even if modifications are made to a source file.  If you do not specify a
93 destination directory the
94 .Nm
95 command forcefully regenerates the MD5 checkfile for every file in the source.
96 .It Fl M
97 Works the same as
98 .Fl m
99 but allows you to specify the name of the MD5 checkfile.
100 .It Fl x
101 Causes
102 .Nm
103 to use the exclusion file ".cpignore" in each directory on the source to
104 determine which files to ignore.  When this option is used, the exclusion
105 filename itself is automatically excluded from the copy.  If this option is
106 not used then the filename ".cpignore" is not considered special and will
107 be copied along with everything else.
108 .It Fl X
109 Works the same as
110 .Fl x
111 but allows you to specify the name of the exclusion file.  This file is
112 automatically excluded from the copy.  Only one exclusion file may be
113 specified.
114 .El
115 .Sh DIAGNOSTICS
116 The
117 .Nm
118 utility exits 0 if no modifications were made, and >0 if modifications
119 were made to the destination.
120 .Sh SEE ALSO
121 .Xr cp 1 ,
122 .Xr cpio 1 ,
123 .Xr tar 1
124 .Sh HISTORY
125 The
126 .Nm
127 command was original created to update servers at BEST Internet circa 1997
128 and was placed under the FreeBSD copyright for inclusion in the ports area
129 in 1999.  The program was written by Matthew Dillon and Dima Ruban.