From owner-freebsd-questions@FreeBSD.ORG Wed Oct 19 19:04:33 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2596E10656B8 for ; Wed, 19 Oct 2011 19:04:33 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id E8D7C8FC1B for ; Wed, 19 Oct 2011 19:04:32 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id p9JJ4Ago092104; Wed, 19 Oct 2011 14:04:10 -0500 (CDT) Date: Wed, 19 Oct 2011 14:04:10 -0500 (CDT) From: Robert Bonomi Message-Id: <201110191904.p9JJ4Ago092104@mail.r-bonomi.com> To: freebsd-questions@freebsd.org, wodfer@gmail.com In-Reply-To: Cc: Subject: Re: Help! Can't delete files ... 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, 19 Oct 2011 19:04:33 -0000 > From owner-freebsd-questions@freebsd.org Wed Oct 19 13:53:33 2011 > Date: Wed, 19 Oct 2011 20:23:36 +0200 > From: Andy Wodfer > To: freebsd-questions > Subject: Help! Can't delete files ... > > A client has uploaded several files through a CMS and these files contain > Norwegian letters (I think). AE O and A. > > I need to delete about 20 files, but I can't do it through the CMS nor by > command line on this FreeBSD 8.1 STABLE server. There's something with the > character encoding/keyboard or server setup I think. > > Please advice. > > This is what a file looks like when I ls: > > 28b Kjoepesenter n?ringsg?rdeier.docx > > ls | more: > > 28b Kjoepesenter n<91>ringsg<86>rdeier.docx > > If I try: > > # rm 28b Kjoepesenter n<91>ringsg<86>rdeier.docx > Ambiguous input redirect A) learn to use wildcards. B) learn to use the '-i' option to rm C) learn to use 'echo' to 'test' filename expansions. For your 'problem' files, put a '?' in anywhere there is a space or a 'strange character'. Check what happens using echo, then use 'rm -i', so you make sure that you delete *only* the particular file you intend to. e.g. for the specific file you cited above try: echo 28b?Kjoepesenter?n?ringsg?rdeier.docx *ASSUMING* that that shows; 28b Kjoepesenter n<91>ringsg<86>rdeier.docx then try: rm -i 28b?Kjoepesenter?n?ringsg?rdeier.docx Assuming that it asks yout about deleting the full file name, type a 'y'. Repeat for each 'problem' file.