Re: Remote file deletion

2004-11-02 Thread Dale Amon
On Thu, Oct 28, 2004 at 09:54:00AM -0700, Wayne Davison wrote:
 On Thu, Oct 28, 2004 at 01:15:18PM +0100, Dale Amon wrote:
  I've looked at the shell command hack but don't see a way to get a
  remote 'rm /mydir/foo' to execute that way.
 
 If you're using ssh or rsh as your rsync connection, you can simply do
 this:
 
 ssh host rm /mydir/foo /mydir/bar /yourdir/baz
 
 or even this:
 
 ssh host xargs rm -rf /tmp/local-list-of-files-and-dirs
 
 If you're trying to do this by talking to a daemon or a restricted
 rsync-only ssh setup, you should be able to transfer an empty directory
 with some simple excludes to do what you want, but it's easiest to copy
 into each directory separately.  For instance, if you want to delete
 mydir/foo, mydir/bar, and yourdir/baz on host host in module mod,
 you could do this:
 
 mkdir emptydir
 rsync -av --include=foo --include=bar --exclude='*' --delete emptydir/ 
 host::mod/mydir
 rsync -av --include=baz --exclude='*' --delete emptydir/ host::mod/yourdir
 rmdir emptydir

Thanks. I opted for the straight ssh option and it 
solved the problem in a simple and foolproof way. I don't
know why I didn't think of that. But there you go. The
value of having people to talk to.

-- 
--
   Dale Amon [EMAIL PROTECTED]+44-7802-188325
   International linux systems consultancy
 Hardware  software system design, security
and networking, systems programming and Admin
  Have Laptop, Will Travel
--


signature.asc
Description: Digital signature
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Remote file deletion

2004-10-28 Thread Dale Amon
I've a particular situation in which I need to sometimes
delete one or two files from a remote site. I haven't
figured out a way to do it with rsync yet... I've considered
playing games with --exclude and --delete but I'm a bit
nervous of the chances of mayhem by a simple error.

Situation is a remote repository to which files are 
added on occasion; there is no local copy. On occasion
it is necessary to delete one or two files by name.
It certainly would be nice to be able to do this via
rsync. I've looked at the shell command hack but don't
see a way to get a remote 'rm /mydir/foo' to execute
that way.

Please respond directly as I am not on the list,
although I will try to check in through the samba.org
web pages.

-- 
--
   Dale Amon [EMAIL PROTECTED]+44-7802-188325
   International linux systems consultancy
 Hardware  software system design, security
and networking, systems programming and Admin
  Have Laptop, Will Travel
--


signature.asc
Description: Digital signature
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Re: Remote file deletion

2004-10-28 Thread Wayne Davison
On Thu, Oct 28, 2004 at 01:15:18PM +0100, Dale Amon wrote:
 I've looked at the shell command hack but don't see a way to get a
 remote 'rm /mydir/foo' to execute that way.

If you're using ssh or rsh as your rsync connection, you can simply do
this:

ssh host rm /mydir/foo /mydir/bar /yourdir/baz

or even this:

ssh host xargs rm -rf /tmp/local-list-of-files-and-dirs

If you're trying to do this by talking to a daemon or a restricted
rsync-only ssh setup, you should be able to transfer an empty directory
with some simple excludes to do what you want, but it's easiest to copy
into each directory separately.  For instance, if you want to delete
mydir/foo, mydir/bar, and yourdir/baz on host host in module mod,
you could do this:

mkdir emptydir
rsync -av --include=foo --include=bar --exclude='*' --delete emptydir/ host::mod/mydir
rsync -av --include=baz --exclude='*' --delete emptydir/ host::mod/yourdir
rmdir emptydir

..wayne..
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html