Delete remote folder

Steven Levine steve53 at earthlink.net
Thu Jun 2 15:57:01 UTC 2016


In <20160602082722.8F11829233B7 at macserver.private>, on 06/02/16
   at 10:27 AM, Fabian Cenedese <Cenedese at indel.ch> said:

Hi Fabian,

>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.

This comes up on the list every now and then.

Here's a snip from an archive message:

  Here is how you would write an "rsyncrm" script that can be invoked like
  "rsyncrm -ni remote::volume/directory".  Note that this reveals the
  attributes of the current directory to the server.

  #!/bin/bash
  victim="${@: -1:1}"
  rsync -d --del --filter="R /$(basename -- "$victim")" --filter='- /*' \
          "${@:1:$#-1}" . "$(dirname -- "$victim")"

This works because it deletes the unwanted directory from the parent
directory.

Steven

-- 
----------------------------------------------------------------------
"Steven Levine" <steve53 at earthlink.net>  Warp/DIY/BlueLion etc.
www.scoug.com www.arcanoae.com www.warpcave.com
----------------------------------------------------------------------




More information about the rsync mailing list