summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2023-01-27 10:59:13 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2023-01-27 11:03:38 -0800
commit20005ca733e111a61212ee8a6890a54583c55562 (patch)
tree97fff68c621a25523b4c61f0ae61bede6e239898 /doc
parentd5868df0d0a6bd09387ece41b62b873fd7c201f9 (diff)
downloadcoreutils-20005ca733e111a61212ee8a6890a54583c55562.tar.gz
mv: new option --no-copy
Wishlist item from Mike Frysinger (Bug#61050). * src/copy.c (copy_internal): Do not fall back on copying if x->no_copy. * src/copy.h (struct cp_options): New member no_copy. * src/mv.c (NO_COPY_OPTION): New constant. (long_options, usage, main): Support --no-copy. * tests/mv/no-copy.sh: New test. * tests/local.mk (all_tests): Add it.
Diffstat (limited to 'doc')
-rw-r--r--doc/coreutils.texi27
1 files changed, 15 insertions, 12 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index f5e531d65..c7494ba47 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -10038,19 +10038,16 @@ failing that if the last file is a directory and the
directory, using the @var{source}s' names.
@end itemize
-@command{mv} can move any type of file from one file system to another.
-Prior to version @code{4.0} of the fileutils,
-@command{mv} could move only regular files between file systems.
-For example, now @command{mv} can move an entire directory hierarchy
-including special device files from one partition to another. It first
-uses some of the same code that's used by @code{cp -a} to copy the
-requested directories and files, then (assuming the copy succeeded)
-it removes the originals. If the copy fails, then the part that was
-copied to the destination partition is removed. If you were to copy
-three directories from one partition to another and the copy of the first
+To move a file, @command{mv} ordinarily simply renames it.
+However, if renaming does not work because the destination's file
+system differs, @command{mv} falls back on copying as if by @code{cp -a},
+then (assuming the copy succeeded) it removes the original.
+If the copy fails, then @command{mv} removes any partially created
+copy in the destination. If you were to copy three directories from
+one file system to another and the copy of the first
directory succeeded, but the second didn't, the first would be left on
-the destination partition and the second and third would be left on the
-original partition.
+the destination file system and the second and third would be left on the
+original file system.
@cindex extended attributes, xattr
@command{mv} always tries to copy extended attributes (xattr), which may
@@ -10114,6 +10111,12 @@ Do not overwrite an existing file; silently do nothing instead.
@mvOptsIfn
This option is mutually exclusive with @option{-b} or @option{--backup} option.
+@item --no-copy
+@opindex --no-copy
+@cindex renaming files without copying them
+If a file cannot be renamed because the destination file system differs,
+fail with a diagnostic instead of copying and then removing the file.
+
@item -u
@itemx --update
@opindex -u