From owner-freebsd-questions@FreeBSD.ORG Wed Aug 30 15:13:24 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D3C1416A4E6 for ; Wed, 30 Aug 2006 15:13:24 +0000 (UTC) (envelope-from wmoran@collaborativefusion.com) Received: from mx00.pub.collaborativefusion.com (mx00.pub.collaborativefusion.com [206.210.89.199]) by mx1.FreeBSD.org (Postfix) with ESMTP id EBB3543D68 for ; Wed, 30 Aug 2006 15:13:22 +0000 (GMT) (envelope-from wmoran@collaborativefusion.com) Received: from collaborativefusion.com (mx01.pub.collaborativefusion.com [206.210.89.201]) (TLS: TLSv1/SSLv3,256bits,AES256-SHA) by wingspan with esmtp; Wed, 30 Aug 2006 11:13:22 -0400 id 0005641B.44F5AB12.0000F30E Received: from Internal Mail-Server (206.210.89.202) by mx01 (envelope-from wmoran@collaborativefusion.com) with AES256-SHA encrypted SMTP; 30 Aug 2006 11:12:27 -0400 Date: Wed, 30 Aug 2006 11:13:21 -0400 From: Bill Moran To: Ensel Sharon Message-Id: <20060830111321.037c293e.wmoran@collaborativefusion.com> In-Reply-To: References: Organization: Collaborative Fusion X-Mailer: Sylpheed version 2.2.7 (GTK+ 2.8.20; i386-portbld-freebsd6.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: deleting with wildcards over ssh ... how ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Aug 2006 15:13:24 -0000 In response to Ensel Sharon : > > I want to delete some remote files with a wildcard, running 'rm' over ssh. > > The obvious syntax doesn't work at all - it doesn't even make an ssh > connection - I think it is interpreting the wildcard locally: > > # ssh user@host rm -rf /some/testdir/* > ssh: No match. > > Then, these combinations of single and double quotes: > > ssh user@host 'rm -rf /some/testdir/*' > > ssh user@host rm -rf '/some/testdir/*' > > ssh user@host 'rm -rf "/some/testdir/*"' > > All connect over ssh, and produce no errors, but the remote files are > still there - nothing was deleted. > > So what is the _right_ way to do this ? Most of those should work. What are the names of the files you are trying to delete? By default, * does not match filenames beginning with a '.'. The best command line would be: ssh user@host 'rm -rf /some/testdir/*' which will cause the local machine to send the command without expanding the * first. The * should then be expanded on the remote system. Try: ssh user@host 'echo /some/testdir/*' to see if it's doing what you expect. -- Bill Moran Collaborative Fusion Inc.