Sebastiaan L. Zoutendijk wrote: > Dear Dale, > > On Friday 2 September 2022, 3.35am -0500, Dale wrote: > >> time rsync -auv --progress --delete /home/dale/Desktop/Crypt/Video/* >> /mnt/10tb/Video/ > What is going on here is due to a subtle interplay of rsync’s syntax and > shell wildcard expansion. You can read about the details of rsync > syntax in its man page, but I’ll illustrate here: > > rsync has two ways to specify a source directory. > > 1. Without a trailing slash: `rsync <options> path1/source path2/dest`. > This syncs path1/source -> path2/dest/source. > > 2. With a trailing slash: `rsync <options> path1/source/ path2/dest`. > This syncs path1/source -> path2/dest. > > Note that the two ways lead to different target directories getting > synced with the source directory. I think the command you are looking > for is therefore > > time rsync -auv --progress --delete /home/dale/Desktop/Crypt/Video /mnt/10tb > > or > > time rsync -auv --progress --delete /home/dale/Desktop/Crypt/Video/ > /mnt/10tb/Video > > NOTE: I have not tested these commands, I would advise you to run them > with --dry-run first. > > Now, why is your original command not deleting the old subdirectory? > Let me illustrate this with another example. Suppose we have the same > directories as in my first example, path1/source and path2/dest. Now > suppose path1/source contains subdirectories foo and bar. These were > synced with path2/dest, which therefore also contains foo and bar. Now > you rename foo to foo-1 in your source directory. So we have > > $ ls path1/source > foo-1 > bar > > $ ls path2/dest > foo > bar > > When you type path1/source/*, it therefore gets expanded to: > path1/source/foo-1 path1/source/bar > > That’s two different source directories, rsync will sync each > separately to a subdirectory of the same name (because there is no > trailing slash) under path2/dest: > > path1/source/foo-1 -> path2/dest/foo-1 > path1/source/bar -> path2/dest/bar > > And what about path2/dest/foo? Well, it is not included in these two > syncs, so rsync leaves it untouched. The --delete option only affects > what is under your sources and targets, here foo-1 and bar, not foo. > > So, to conclude, what you probably want is to use one of the rsync > commands I listed above, which sync the entire source directory with the > target, and will clean up anything under the target that is not under > the source. Instead, what your old command was doing is to look at > every subdirectory and file of the source one by one, which will miss > anything in the target that does not have a corresponding item in the > source. > > I hope this helps, > > Sincerely, > > Bas > > > -- > Sebastiaan L. Zoutendijk • slzoutend...@gmail.com > >
Replying here for Ramon too. When I read Ramon's reply earlier, I remembered that the trailing slash and even the "*" I had in there was likely the cause. I recalled reading how that affects all sorts of things when it comes to copying or moving files ages ago. Thing is, it can get a little complicated. However, once one understands how it works, it kinda makes sense that it works that way. :-D Reading both replies helped jog my memory, which is awful nowadays. :-( So for anyone running up on either of these two great explanations, this is what worked for me. time rsync -auv --progress --delete /home/dale/Desktop/Crypt/Videos /mnt/10tb/ When I ran that, it deleted directories that I had changed the names of or something that were no longer on the source but were still on the target. Basically, for the source I removed the "/*" part and the directory on the target. It freed up quite a bit of space too. That works like I expect it to. Now to go fix the other backup script thingys so they work right. No telling how many of those have deleted directories on them. Thanks much to both. Reminded me of something I'd forgot about. Something we should all remember but sadly, I didn't. :/ Dale :-) :-) P. S. I ordered a 14TB drive. It's a Seagate EXOS X18 14TB ST14000NM000J which I think doesn't have that pin 3 problem. I got it for $150. My plan, replace one of the 8TB drives in my system, then I can put the 8TB drive in whatever storage solution I build. I also measured my current fire safe, I can't find a case that will fit in there that holds enough drives. I'd have to go with a ITX, Raspberry Pi type thing to get it to fit in the safe and even that could be a tight squeeze. I could put it in a out building but I really hate to put anything electronic in it. Stuff grows in there, rust too. Air is pretty stale and just not good for anything electronic. This fast internet is causing some problems but I'm still loving it. :-D