#StackBounty: #rsync rsync –delete is not working

Bounty: 200

OS is Debian 10, rsync version 3.1.3. I’m running rsync like this:

time rsync -ar --delete --info=progress2 --files-from=filelist.txt . /path/to/dest

This works to copy the files over, but doesn’t delete anything that’s been removed! That is a huge problem. The only workaround I have found is to simply nuke the entire destination and just copy everything over again, but this takes a huge amount of time and basically negates the point of using rsync in the first place.

Is this a bug? How do I get rsync to work properly, honoring the –delete flag like it’s supposed to?

Edit:

For example:

  • If filelist.txt cotains "foo" then /path/to/dest will contain "foo".
  • If filelist.txt cotains "foo" and "bar" then /path/to/dest will contain "foo" and "bar".
  • If filelist.txt cotains "foo", "bar", and "bat" then /path/to/dest will contain "foo", "bar", and "bat".
  • etc

Assume "foo" "bar" "bat" etc are directories.


Get this bounty!!!

#StackBounty: #rsync rsync: Don't create destination directory

Bounty: 50

I want to rsync my root directory to an external hard disk mounted under /media/guettli/backup1t/.

rsync -xavi --delete --delete-excluded 
  --exclude '...' 
  /  /media/guettli/backup1t/

Something went wrong with the mounting and rsync happily created /media/guettli/backup1t/ in the root directory and rsynced copied files there and not onto the external hard drive.

I would like to avoid this.

I could do it with a shell script which checks that /media/guettli/backup1t/ exists before starting rsync, but I would prefer an option to rsync.

How can I tell rsync to not start the sync, if the destination does not exist?


Get this bounty!!!

#StackBounty: #rsync rsync: Don't create destination directory

Bounty: 50

I want to rsync my root directory to an external hard disk mounted under /media/guettli/backup1t/.

rsync -xavi --delete --delete-excluded 
  --exclude '...' 
  /  /media/guettli/backup1t/

Something went wrong with the mounting and rsync happily created /media/guettli/backup1t/ in the root directory and rsynced copied files there and not onto the external hard drive.

I would like to avoid this.

I could do it with a shell script which checks that /media/guettli/backup1t/ exists before starting rsync, but I would prefer an option to rsync.

How can I tell rsync to not start the sync, if the destination does not exist?


Get this bounty!!!

#StackBounty: #rsync rsync: Don't create destination directory

Bounty: 50

I want to rsync my root directory to an external hard disk mounted under /media/guettli/backup1t/.

rsync -xavi --delete --delete-excluded 
  --exclude '...' 
  /  /media/guettli/backup1t/

Something went wrong with the mounting and rsync happily created /media/guettli/backup1t/ in the root directory and rsynced copied files there and not onto the external hard drive.

I would like to avoid this.

I could do it with a shell script which checks that /media/guettli/backup1t/ exists before starting rsync, but I would prefer an option to rsync.

How can I tell rsync to not start the sync, if the destination does not exist?


Get this bounty!!!

#StackBounty: #rsync rsync: Don't create destination directory

Bounty: 50

I want to rsync my root directory to an external hard disk mounted under /media/guettli/backup1t/.

rsync -xavi --delete --delete-excluded 
  --exclude '...' 
  /  /media/guettli/backup1t/

Something went wrong with the mounting and rsync happily created /media/guettli/backup1t/ in the root directory and rsynced copied files there and not onto the external hard drive.

I would like to avoid this.

I could do it with a shell script which checks that /media/guettli/backup1t/ exists before starting rsync, but I would prefer an option to rsync.

How can I tell rsync to not start the sync, if the destination does not exist?


Get this bounty!!!

#StackBounty: #rsync rsync: Don't create destination directory

Bounty: 50

I want to rsync my root directory to an external hard disk mounted under /media/guettli/backup1t/.

rsync -xavi --delete --delete-excluded 
  --exclude '...' 
  /  /media/guettli/backup1t/

Something went wrong with the mounting and rsync happily created /media/guettli/backup1t/ in the root directory and rsynced copied files there and not onto the external hard drive.

I would like to avoid this.

I could do it with a shell script which checks that /media/guettli/backup1t/ exists before starting rsync, but I would prefer an option to rsync.

How can I tell rsync to not start the sync, if the destination does not exist?


Get this bounty!!!

#StackBounty: #rsync #cygwin rsync exclude AppData but include Firefox bookmarks?

Bounty: 50

I want to backup my Windows home directory using cygwin and rsync:

rsync.exe -vrptlH --delete --exclude=AppData "/cygdrive/C/Users/user1/" "/cygdrive/D/backup/"

As you can see I excluded the AppData directory.

Is it possible to include my Firefox bookmarks in the following path?

AppData/Roaming/Mozilla/Firefox/Profile/*/places.sqlite

The asterisk stands for a the profile name. It’s not known because Firefox generates random names there.

Maybe it’s possible using an exclude script with –exclude-from?

I know it’s possible to copy the places.sqlite to another folder using power shell and then backup this folder.

But maybe it’s possible directly with rsync.


Get this bounty!!!

#StackBounty: #backup #rsync #timeshift Timeshift setup: how to backup system with programs and all theirs configs, but without Video, …

Bounty: 50

I only make rare snapshots on an external drive (RSYNC option). I would like to backup all my programs with all their configuration settings as I have them now, but when I restore my system all programs are reset to their defaults as if newly installed.

I see an option to include all home files, but I don’t want Timeshift to backup my Vido, Music etc (I do that by other methods if I need to).

I imagine the configurations I want to save are set under /home option of Timeshift.

Is the “Include hidden” option (for /home) supposed to provide what I ask – while “Include all” would save also Videos, Music etc?

Or is the result influenced by options for /root? Are those options affecting what I ask?

enter image description here

Also: considering my stated goal, is there a difference between the results of restoring a snapshot on top of my existing system compared to restoring it on a new empty partition?


Get this bounty!!!

#StackBounty: #android #rsync #mtp Rsync to mtp mounted android does not work

Bounty: 50

I tried to sync ogg-audio-files to my android device like this:

rsync -av piano /run/user/1000/gvfs/mtp:host=%5Busb%3A002%2C005%5D/SanDisk/Music/

===> rsync -av piano/ /run/user/1000/gvfs/mtp:host=%5Busb%3A002%2C007%5D/SanDisk/Music/
sending incremental file list
rsync: failed to set times on "/run/user/1000/gvfs/mtp:host=%5Busb%3A002%2C007%5D/SanDisk/Music/.": Operation not supported (95)
...
foo-bar/one.ogg
...
rsync: mkstemp "/run/user/1000/gvfs/mtp:host=%5Busb%3A002%2C007%5D/SanDisk/Music/foo-bar/one.ogg.0gzy9t" failed: Operation not supported (95)

But only the directory got created. No file was transfered:

===> find /run/user/1000/gvfs/mtp:host=%5Busb%3A002%2C007%5D/SanDisk/Music/piano

/run/user/1000/gvfs/mtp:host=%5Busb%3A002%2C007%5D/SanDisk/Music/piano/foo-bar

How to rsync between my android device and my Ubuntu PC?

I found a work-around: I unplugged the micro-SC card from the android device and inserted it into the sd-card reader of my laptop. But a solution where I don’t need to do this would be nice.


Get this bounty!!!

#StackBounty: #linux #permissions #rsync Set permissions with rsync for all files but the root directory

Bounty: 50

I want to sync two directories with rsync, preserving the permissions of all files. My user foo does have write access to the target directory, but does not own it.

$ ls -l                                                                                                                                                                                
total 8
drwxrwx--- 2 foo  foo 4096 Jun  3 16:01 a
drwxrwxr-x 3 root foo 4096 Jun  3 16:02 b

While syncing does work, it causes a permission error and a bad exit code:

$ rsync -av  -O  --delete a/ b/                                                                                                                                                        
sending incremental file list
rsync: failed to set permissions on "/tmp/r/b/.": Operation not permitted (1)
deleting 2
./
1

sent 115 bytes  received 138 bytes  506.00 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]

I am aware, that I could use the --no-perm option, but this would prevent setting the permissions of any files and not just of the target directory.

Another solution would be to use rsync -av --delete a/* b/, but this would prevent deleted files in a/ from being removed in b/.

This is probably a duplicate of this question, which remains unanswered since 2010 🙁


Get this bounty!!!