Delete remote folder

Hans-Christian Jehg hc at
Thu Jun 2 08:52:47 UTC 2016

Try having a look at this, for inspiration.

It does require the capability of hard-links on the remote end though... 
and it does not resolve your "delete target directory" either, but it 
might save you some fiddeling around :-)


On 02-06-2016 10:27, Fabian Cenedese wrote:
> Hi
> I'm trying to build a backup system based on rsync. It should
> work with different destinations (local, share, remote etc) that's
> why I'm looking for ways how every operation can be controlled
> from the client side.
> I want to create full backups and incremental backups. For the
> incremental backups I use --compare-dest lastfullbackup. This
> works nicely except that the whole directory tree is created
> even if no files are copied. This is mentioned several times
> on the Internet and the usual answer is that there's no way
> around it because of the way that rsync works. I don't mind
> that they are created if there's a (rsync-)way to delete them
> again afterwards, something like
> rsync -a --delete --prune-empty-dirs dest dest
> Unfortunately at least one place has to be local, doing a
> remote-remote is not possible.
> The second problem is that I want to delete older backups.
> I can use
> rsync -a --delete empty_local_folder remote_folder_to_delete
> to get rid of the contents. However the folder itself still remains.
> So after a while I'd have a lot of empty folders.
> As I want this to work on various systems I can't (and don't
> want to) use remote shell hacks like "do_something && rsync ".
> Also the policy of what and when to delete should be configurable
> from the client.
> Are there pure rsync ways to solve these two problems?
> Thanks
> bye  Fabi

More information about the rsync mailing list