Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A server I'm working on has a rsync module "foo". So I can view the available files on it as follows:

rsync -rltvz
receiving incremental file list
drwxr-xr-x       20480 2013/05/30 17:43:34 .
drwxrwxr-x        4096 2012/06/15 03:00:30 BAR

What command can I use to delete folder BAR from the server? There is a --remove-source-files option, but what I need is "--remove-source-directories"

I've searched for examples of how to do this, but everything I've found assumes that the source is mounted on the local file system.

share|improve this question

migrated from May 31 '13 at 2:55

This question came from our site for professional and enthusiast programmers.

One solution I've found is to make the desired changes locally then rsync in the opposite direction.

# Copy files to local machine
rsync -rltvz .
# Delete the folder I don't want locally
rmdir BAR
# Rsync in the opposite direction:
rsync --delete --force -rltvz .
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .