<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    <br>
    On 31-10-2010 16:39, Edvinas Valatka wrote:
    <blockquote
      cite="mid:20101031173911.13e724ed@arch.edacval.homelinux.org"
      type="cite">
      <pre wrap="">On Sun, 31 Oct 2010 03:15:37 +0100
Vahsen Beheer <a class="moz-txt-link-rfc2396E" href="mailto:beheer@vahsen.nl">&lt;beheer@vahsen.nl&gt;</a> wrote:

</pre>
      <blockquote type="cite">
        <pre wrap="">Hi!

I am backing up  (using --link-dest, hard links) to a NAS which has
an 'rsync' daemon running. I do not have ssh access to this
Storage-device. Part of my script needs to delete whole remote
directory trees. This seems difficult with rsync.


A nice trick is to make an empty source directory:

rsync -a --delete /tmp/empty-dir/
remote-host::Backups/daily.20101030-0155


This works perfect. It deletes the contents of destination. However,
need it to also delete the destination directory its-self.

This seems something very easy, but after searching for many hours in
the manual, FAQ, Web and forum did not reveal a solution.


Is it possible to have rsync also delete the 'destination-directory' ?
(Or do i need to work from its parent-directory of the destination -
here the module itsself ? Or do something with filters?)

The next also does not work (it deletes all! from the Backups module):

rsync -a --exclude='/***' --include='/daily.20101030-0155/'
--delete /tmp/empty-dir/ remote-host::Backups


Any tips? Did anyone ever tried this? :)
Thanks a lot in advance!
Robert


PS: I also looked into the --prune-empty-dirs option, without success
though.






</pre>
      </blockquote>
      <pre wrap="">
Or: rsync -ndivv -f 'P!p /daily.20101030-0155' --del  /tmp/empty_dir/
remote-host::Backups/
</pre>
    </blockquote>
    <br>
    Hi Edvinas :)<br>
    <br>
    Thanks a lot for your response.<br>
    <br>
    I tried all tree of your suggestions, but i get the message:<br>
    <br>
    <blockquote>1045: rsync -ndivv -f 'P!p daily.20101022-2209.5212'
      --del ~/empty/&nbsp; io::Backups<br>
      opening tcp connection to io port 873<br>
      sending daemon args: --server -vvnd --no-r "--log-format=%i"
      --delete-during . Backups/<br>
      <b>filter rules are too modern for remote rsync.</b><br>
      rsync error: protocol incompatibility (code 2) at
      /home/lapo/packaging/rsync-3.0.7-1/src/rsync-3.0.7/exclude.c(1211)
      [sender=3.0.7]<br>
    </blockquote>
    <br>
    My rsync client is 3.0.7 but the daemon on my NAS-server has an
    older version:<br>
    rsync 2.6.9 (the last one before 3.0).<br>
    <br>
    Looking on the web for a 2.6.9 manpage (which i by the way was not
    able to find at the rsync website),<br>
    i managed to find out it might be the 'p' (in the previous '-!pr')
    which causes the problem. <br>
    <br>
    Any other hints?<br>
    <br>
  </body>
</html>