summaryrefslogtreecommitdiff
path: root/doc/coreutils.texi
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2023-04-01 16:27:52 +0100
committerPádraig Brady <P@draigBrady.com>2023-04-08 12:11:50 +0100
commitdb28af406f311ac8f78604cc5906613866aecef5 (patch)
tree23c7a3ab85ed425be66ee0ddc8b298769171445d /doc/coreutils.texi
parent5891d28edebe229f1a6057275e281b10c1f2247b (diff)
downloadcoreutils-db28af406f311ac8f78604cc5906613866aecef5.tar.gz
cp,mv: add --update=none to always skip existing files
Add --update=none which is equivalent to the --no-clobber behavior from before coreutils 9.2. I.e. existing files are unconditionally skipped, and them not being replaced does not affect the exit status. * src/copy.h [enum Update_type]: A new type to support parameters to the --update command line option. [enum Interactive]: Add I_ALWAYS_SKIP. * src/copy.c: Treat I_ALWAYS_SKIP like I_ALWAYS_NO (-n), except that we don't fail when skipping. * src/system.h (emit_update_parameters_note): A new function to output the description of the new --update parameters. * src/cp.c (main): Parse --update arguments, ensuring that -n takes precedence if specified. (usage): Describe the new option. Also allude that -u is related in the -n description. * src/mv.c: Accept the new --update parameters and update usage() accordingly. * doc/coreutils.texi (cp invocation): Describe the new --update parameters. Also reference --update from the --no-clobber description. (mv invocation): Likewise. * tests/mv/update.sh: Test the new parameters. * NEWS: Mention the new feature. Addresses https://bugs.gnu.org/62572
Diffstat (limited to 'doc/coreutils.texi')
-rw-r--r--doc/coreutils.texi28
1 files changed, 26 insertions, 2 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 7852e9f8a..2188922c6 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -9236,9 +9236,9 @@ results in an error message on systems that do not support symbolic links.
@optNoTargetDirectory
@item -u
-@itemx --update
+@itemx --update[=@var{which}]
@opindex -u
-@opindex --update
+@opindex --update[=@var{which}]
@cindex newer files, copying only
Do not copy a non-directory that has an existing destination with the
same or newer modification timestamp; instead, silently skip the file
@@ -9254,6 +9254,26 @@ for example), that will take precedence; consequently, depending on the
order that files are processed from the source, newer files in the destination
may be replaced, to mirror hard links in the source.
+@macro whichUpdate
+@var{which} gives more control over which existing files in the
+destination are replaced, and its value can be one of the following:
+
+@table @samp
+@item all
+This is the default operation when an @option{--update} option is not specified,
+and results in all existing files in the destination being replaced.
+
+@item none
+This is similar to the @option{--no-clobber} option, in that no files in the
+destination are replaced, but also skipping a file does not induce a failure.
+
+@item older
+This is the default operation when @option{--update} is specified, and results
+in files being replaced if they're older than the corresponding source file.
+@end table
+@end macro
+@whichUpdate
+
@item -v
@itemx --verbose
@opindex -v
@@ -10165,6 +10185,8 @@ of its permissions, and fail if the response is not affirmative.
Do not overwrite an existing file; silently fail instead.
@mvOptsIfn
This option is mutually exclusive with @option{-b} or @option{--backup} option.
+See also the @option{--update=none} option which will
+skip existing files but not fail.
@item --no-copy
@opindex --no-copy
@@ -10188,6 +10210,8 @@ same source and destination.
This option is ignored if the @option{-n} or @option{--no-clobber}
option is also specified.
+@whichUpdate
+
@item -v
@itemx --verbose
@opindex -v