Commit a272ff8c authored by Wayne Davison's avatar Wayne Davison

Changed --skip-empty-dirs (-k) to --prune-empty-dirs (-m) and

improved the docs a bit more, including documenting how "protect"
filtering affects empty dirs.
parent 7402d583
......@@ -349,7 +349,7 @@ to the detailed description below for a complete description. verb(
--partial keep partially transferred files
--partial-dir=DIR put a partially transferred file into DIR
--delay-updates put all updated files into place at end
-k, --skip-empty-dirs skip empty directory chains
-m, --prune-empty-dirs prune empty directory chains from file-list
--numeric-ids don't map uid/gid values by user/group name
--timeout=TIME set I/O timeout in seconds
-I, --ignore-times don't skip files that match size and time
......@@ -1386,21 +1386,35 @@ See also the "atomic-rsync" perl script in the "support" subdir for an
update algorithm that is even more atomic (it uses bf(--link-dest) and a
parallel hierarchy of files).
dit(bf(-k, --skip-empty-dirs)) This option tells the receiving rsync to get
dit(bf(-m, --prune-empty-dirs)) This option tells the receiving rsync to get
rid of empty directories from the file-list, including nested directories
that have no non-directory children. This is useful for avoiding the
creation of a bunch of useless directories when the sending rsync is
recursively scanning a hierarchy of files using include/exclude/filter
directives. This also affects what directories get deleted when a delete
option was specified (but keep in mind that excluded files are also
protected from deletion).
rules.
Because the file-list is actually being pruned, this option also affects
what directories get deleted when a delete is active. However, keep in
mind that excluded files and directories can prevent existing items from
being deleted (because an exclude hides source files and protects
destination files).
You can prevent the pruning of certain empty directories from the file-list
by using a global "protect" filter. For instance, this option would ensure
that the directory "emptydir" was kept in the file-list:
quote( --filter 'protect emptydir/')
Here's an example that copies all .pdf files in a hierarchy, only creating
the necessary destination directories to hold the .pdf files, and ensures
that any superfluous files and directories in the destination are removed
(due to a hide filter on non-directories being used instead of an exclude):
(note the hide filter of non-directories being used instead of an exclude):
quote( rsync -avm --del --include='*.pdf' -f 'hide! */' src/ dest)
quote( rsync -avk --del --include='*.pdf' -f 'hide! */' src/ dest)
If you didn't want to remove superfluous destination files, the more
time-honored options of "--include='*/' --exclude='*'" would work fine
in place of the hide-filter (if that is more natural to you).
dit(bf(--progress)) This option tells rsync to print information
showing the progress of the transfer. This gives a bored user
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment