So.
I need help from bash wizards.
I need a command that I can use to backup shit.
What I want it to do:
Check content of target folder1 recursively and compare it with the content of a target folder2, again recursively.
If the target folder2 has a file that doesn't exists in the folder1 the file is removed.
If folder1 has a file that folder2 doesn't have, it gets created, this includes folders
If folder2 and folder1 have a file with the same name but the file is not the same (difference in size or whatever) then the file in folder 2 is replaced by a copy of what is in folder1
I would like the process to be possible to interrupt at any moment and to start it again whenever without fucking it up.
What can I do to achieve this?
Conversation
Notices
-
Trash Panda [shapeshifter era] (raccoon@hollow.raccoon.quest)'s status on Sunday, 01-Dec-2024 04:01:00 JST Trash Panda [shapeshifter era] -
Dushman (dushman@hollow.raccoon.quest)'s status on Sunday, 01-Dec-2024 04:00:55 JST Dushman @wendigo@metalhead.club @raccoon@hollow.raccoon.quest
I'd recommend rsync for that usecase too, it's simpler. -
Brian Nicar (wendigo@metalhead.club)'s status on Sunday, 01-Dec-2024 04:00:57 JST Brian Nicar @raccoon rsync, then. That's what I usually use for that type of operation. However, rclone sync will do pretty much the same thing. It works on a local backup scheme, too, if you set up the endpoint correctly...
-
Trash Panda [shapeshifter era] (raccoon@hollow.raccoon.quest)'s status on Sunday, 01-Dec-2024 04:00:58 JST Trash Panda [shapeshifter era] @wendigo@metalhead.club
Thanks Brian, I looked it up, neat project and I actually may have uses for it, but not for the specific thing I have in mind now.
The main use for this would be keeping a backup of a 4TB drive to another 4TB drive in case on of the two failed :P -
Brian Nicar (wendigo@metalhead.club)'s status on Sunday, 01-Dec-2024 04:00:59 JST Brian Nicar @raccoon rclone is one option.
-
Dushman (dushman@hollow.raccoon.quest)'s status on Sunday, 01-Dec-2024 04:07:02 JST Dushman @wendigo@metalhead.club @raccoon@hollow.raccoon.quest
If you want it done in the background, read the manual so you know what command you wanna use then just setup a cron/anacron job that runs it every day or however often you want. I do it like that for some of my own stuff. -
Dushman (dushman@hollow.raccoon.quest)'s status on Sunday, 01-Dec-2024 04:07:33 JST Dushman @wendigo@metalhead.club @raccoon@hollow.raccoon.quest
Pretty convenient cuz then you don't have to remember yk -
Brian Nicar (wendigo@metalhead.club)'s status on Sunday, 01-Dec-2024 04:09:52 JST Brian Nicar @dushman @raccoon Yeah, I do that with rclone and AWS. Although, I think I'm going to switch to restic with a rclone backend...
Dushman likes this.
-