Hello Dale, if I understand you correctly, you had renamed the source directory
"/home/dale/Desktop/Crypt/Video/" to "/home/dale/Desktop/Crypt/Video-1/" and want to have it removed in the target directory, which is still "/mnt/10tb/Video/"?Important!: Please read everything first, then do an isolated test in "/tmp/", since the commands are dangerous!:
You can instruct "rsync" to copy the entire parent directory:
$ rsync --delete "[...]/Crypt/" "/mnt/10tb"
Note the trailing slash behind "Crypt", which is an indicator[1] to
tell "rsync", that it is a directory and that all files and
subdirectories should be copied to the target directory "/mnt/10tb".
If something is missing in the source directory "[...]/Crypt/", it
will be also deleted in "/mnt/10tb"!
Side notes, which may be useful:
1. "rsync" is also capable of creating the (missing) target directory:
$ rsync --delete "[...]/Crypt/Video-1/" "/mnt/10tb/something"
"rsync" creates the target directory "/mnt/10tb/something" first and
then copies all files and subdirectories from the source directory
"[...]/Crypt/Video-1/" to it. But "/mnt/10tb/Video/" would still be
orphaned.
2. There is a parameter, called "--mkpath"[2], which creates all
missing subdirectories of the target directory first.
-Ramon
[1] See "man 1 rsync" "USAGE":
"A trailing slash on the source changes this behavior to avoid creating
an additional directory level at the destination. You can think of a
trailing / on a source as meaning "copy the contents of this directory"[...]
[2] See "man 1 rsync". On 02/09/2022 10:35, Dale wrote:
time rsync -auv --progress --delete/home/dale/Desktop/Crypt/Video/* /mnt/10tb/Video/ I've tried removing the -u, adding --force but no change. Basically, if I remove a directory on the source, how do I get it to remove the same on the backup/target? I went through the options on the man page and nothing hit me as a fix. What am I missing?
-- GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF
OpenPGP_signature
Description: OpenPGP digital signature

