Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

rsync -rltvz 10.100.100.1::foo
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 stackoverflow.com May 31 '13 at 2:55

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

1 Answer 1

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 10.100.100.1::foo .
# Delete the folder I don't want locally
rmdir BAR
# Rsync in the opposite direction:
rsync --delete --force -rltvz . 10.100.100.1::foo
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.