1 |
Hello Dale,
|
2 |
|
3 |
if I understand you correctly, you had renamed the source directory
|
4 |
|
5 |
"/home/dale/Desktop/Crypt/Video/" to
|
6 |
"/home/dale/Desktop/Crypt/Video-1/" and
|
7 |
|
8 |
want to have it removed in the target directory, which is still
|
9 |
|
10 |
"/mnt/10tb/Video/"?
|
11 |
|
12 |
Important!: Please read everything first, then do an isolated test in
|
13 |
"/tmp/", since the commands are dangerous!:
|
14 |
|
15 |
You can instruct "rsync" to copy the entire parent directory:
|
16 |
|
17 |
$ rsync --delete "[...]/Crypt/" "/mnt/10tb"
|
18 |
|
19 |
Note the trailing slash behind "Crypt", which is an indicator[1] to
|
20 |
tell "rsync", that it is a directory and that all files and
|
21 |
subdirectories should be copied to the target directory "/mnt/10tb".
|
22 |
If something is missing in the source directory "[...]/Crypt/", it
|
23 |
will be also deleted in "/mnt/10tb"!
|
24 |
|
25 |
Side notes, which may be useful:
|
26 |
|
27 |
1. "rsync" is also capable of creating the (missing) target directory:
|
28 |
|
29 |
$ rsync --delete "[...]/Crypt/Video-1/" "/mnt/10tb/something"
|
30 |
|
31 |
"rsync" creates the target directory "/mnt/10tb/something" first and
|
32 |
then copies all files and subdirectories from the source directory
|
33 |
"[...]/Crypt/Video-1/" to it. But "/mnt/10tb/Video/" would still be
|
34 |
orphaned.
|
35 |
|
36 |
2. There is a parameter, called "--mkpath"[2], which creates all
|
37 |
missing subdirectories of the target directory first.
|
38 |
|
39 |
-Ramon
|
40 |
|
41 |
[1] See "man 1 rsync" "USAGE":
|
42 |
"A trailing slash on the source changes this behavior to avoid creating
|
43 |
an additional directory level at the destination. You can think of a
|
44 |
trailing / on a source as meaning "copy the contents of this directory"[...]
|
45 |
[2] See "man 1 rsync".
|
46 |
|
47 |
|
48 |
On 02/09/2022 10:35, Dale wrote:
|
49 |
> time rsync -auv --progress --delete/home/dale/Desktop/Crypt/Video/* |
50 |
> /mnt/10tb/Video/ |
51 |
> |
52 |
> |
53 |
> I've tried removing the -u, adding --force but no change. Basically, if |
54 |
> I remove a directory on the source, how do I get it to remove the same |
55 |
> on the backup/target? I went through the options on the man page and |
56 |
> nothing hit me as a fix. What am I missing? |
57 |
|
58 |
--
|
59 |
GPG public key: 5983 98DA 5F4D A464 38FD CF87 155B E264 13E6 99BF |