copy-synchronize folders & files -- How? [UNRESOLVED]

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

copy-synchronize folders & files -- How? [UNRESOLVED]

Post by markfilipak »

Overview: I thought using 'rsync' resolved the problem, but it turns out that 'rsync' doesn't verify writes and can't be made to verify writes (regardless of what the 'rsync' documentation says), so this issue is still unresolved.

I need to automatically make a backup of my TBird profile on shutdown.
How to schedule it for shutdown I will leave for another day.
Today, I just want to learn how to create the backup.

It should copy-synchronize from '~/.thunderbird/0ysydkep.default' to '/media/sf_G_DRIVE/thunderbird/0ysydkep.default'.
It should be recursive.
It should delete files in '/media/sf_G_DRIVE/thunderbird/0ysydkep.default' that no longer exist in '~/.thunderbird/0ysydkep.default'.
It should skip files that have not changed.
I don't want to archive or compress, just copy.

I've been struggling with this off and on for days.

Any ideas?

Related: Is there a list of built-in commands? Submitting "help" produces an incomplete list.
Last edited by LockBot on Fri Jan 06, 2023 11:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: copy-synchronize folders & files -- How?

Post by Cosmo. »

At first, copy the complete .thunderbird folder. This costs a few bytes, but it makes life easier in case, that you need the backup later for another computer.

Second: I recommend to use the backup-software BackInTime. For files, that have not been changed, it creates a hard link, that means near to no time needed and absolutely no space.

Third: Don't backup before shutting down, but if you boot. BackInTime can be set to do this backup automatically.
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: copy-synchronize folders & files -- How?

Post by markfilipak »

Cosmo. wrote: Wed Jul 06, 2022 1:38 pm At first, copy the complete .thunderbird folder. This costs a few bytes, but it makes life easier in case, that you need the backup later for another computer.

Second: I recommend to use the backup-software BackInTime. For files, that have not been changed, it creates a hard link, that means near to no time needed and absolutely no space.

Third: Don't backup before shutting down, but if you boot. BackInTime can be set to do this backup automatically.
Thank you for your suggestions, Cosmo. I don't want hard links. I just want to copy-synchronize.
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: copy-synchronize folders & files -- How?

Post by Cosmo. »

markfilipak wrote: Wed Jul 06, 2022 1:44 pm I don't want hard links.
Do you have a reason?

If you want simply a copy, than do a copy, every time to another target subdirectory. Be prepared that after 1 week the needed space will be 7 times the original, after a month 30 times.

You can also use FreeFileSync. https://freefilesync.org/download.php. The tool is fine, but I would not name the result as backup; you used this word in the first sentence.
hans123
Level 3
Level 3
Posts: 149
Joined: Mon Jun 11, 2007 11:15 am

Re: copy-synchronize folders & files -- How?

Post by hans123 »

use rsync:

Code: Select all

rsync -rtv --delete /sourcedir/ /destdir
note: sourcedir with backslash at the end, destdir without
rsync is very powerful and fast.
search the internet for "systemd hook at shutdown" to execute this at shutdown.
User avatar
AndyMH
Level 21
Level 21
Posts: 13728
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: copy-synchronize folders & files -- How?

Post by AndyMH »

I use backintime to take care of everything in home. If I was going to use a script, I'd use rsync, or as an alternative to freefilesync - unison.
search the internet for "systemd hook at shutdown" to execute this at shutdown.
If you find this too difficult, get your script to shutdown the system.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: copy-synchronize folders & files -- How?

Post by markfilipak »

Cosmo. wrote: Wed Jul 06, 2022 1:53 pm
markfilipak wrote: Wed Jul 06, 2022 1:44 pm I don't want hard links.
Do you have a reason?
The result has to be readable by Windows.
If you want simply a copy, than do a copy, every time to another target subdirectory. Be prepared that after 1 week the needed space will be 7 times the original, after a month 30 times.
I don't want to do that.
You can also use FreeFileSync. https://freefilesync.org/download.php. The tool is fine, but I would not name the result as backup; you used this word in the first sentence.
Sorry. How about incremental backup?
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: copy-synchronize folders & files -- How?

Post by Cosmo. »

markfilipak wrote: Wed Jul 06, 2022 3:19 pm The result has to be readable by Windows.
This excludes the usage of a Linux file system.

Take a look at FreeFileSync, it has a number of synchronization options. It is also available for Windows. Only you can check and decide, if this is what you want.
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: copy-synchronize folders & files -- How?

Post by markfilipak »

AndyMH wrote: Wed Jul 06, 2022 2:32 pm... If you find this too difficult, get your script to shutdown the system.
That's an excellent idea!! I could change my "shutdown now" menu item to a shutdown script that does all sorts of things, ending with "shutdown now".
Last edited by markfilipak on Wed Jul 06, 2022 7:32 pm, edited 1 time in total.
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: copy-synchronize folders & files -- How?

Post by markfilipak »

Cosmo. wrote: Wed Jul 06, 2022 3:29 pm... Take a look at FreeFileSync, it has a number of synchronization options. It is also available for Windows. Only you can check and decide, if this is what you want.
What about this:

Code: Select all

rsync --delete --recursive --times ~/.thunderbird/0ysydkep.default/ /media/sf_G_DRIVE/~[.thunderbird][0ysydkep.default]
Yes, the target directory's name is ~[.thunderbird][0ysydkep.default] -- not a typo.

Do you see anything I should know? Any hazards? I value all opinions.
markfilipak
Level 6
Level 6
Posts: 1173
Joined: Sun Mar 10, 2013 8:08 pm
Location: Mansfield, Ohio

Re: copy-synchronize folders & files -- How?

Post by markfilipak »

This is a wrap!
My shutdown script, 'shutdown.sh':

Code: Select all

#!/bin/bash
echo Backing up '~/.thunderbird/0ysydkep.default/' as '/media/sf_G_DRIVE/~[.thunderbird][0ysydkep.default]'. Please wait.
rsync --delete --recursive --times ~/.thunderbird/0ysydkep.default/ /media/sf_G_DRIVE/~[.thunderbird][0ysydkep.default]
shutdown now
works. I'd be much happier with my profile out in a VBox shared folder (that can grow and grow and grow without bumpping into the fixed size of my virtual machine), but until Mozilla fixes their bugs -- Yeah, right! -- this will have to do.

Thanks, Cosmo. Thanks for suggesting rsync, Hans. And thanks, Andy, for the shutdown idea. You folks are the best.
Locked

Return to “Beginner Questions”