From owner-freebsd-isp@FreeBSD.ORG Fri Apr 25 06:55:10 2003 Return-Path: Delivered-To: freebsd-isp@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2232E37B401 for ; Fri, 25 Apr 2003 06:55:10 -0700 (PDT) Received: from skyweb.ca (smtp-2.vancouver.ipapp.com [216.152.192.208]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4BDB043FE0 for ; Fri, 25 Apr 2003 06:55:09 -0700 (PDT) (envelope-from mjohnston@skyweb.ca) Received: from mjohnston ([209.5.243.50]) by smtp-2.vancouver.ipapp.com ; Fri, 25 Apr 2003 06:55:07 -0700 From: "Mark Johnston" To: "'Dave [Hawk-Systems]'" Date: Fri, 25 Apr 2003 08:55:23 -0500 Message-ID: <002601c30b32$51aa9530$be0fa8c0@MJOHNSTON> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal cc: freebsd-isp@freebsd.org Subject: Re: mv file with illegal character <- twist X-BeenThere: freebsd-isp@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Internet Services Providers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Apr 2003 13:55:10 -0000 Dave [Hawk-Systems] wrote: > how about this, rm du and any other commands show an error because the > filename is a non-printable character... > > ls -laB shows it as > > - l\010\010\010\010 > > ideas? I tried this and wound up deleting it the same way I created it: rm `echo -e l\\\010\\\010\\\010` I don't have much shell-fu, so this could probably be done a better way, but it did the trick. I'd recommend a more general fix for the problem, though - maybe something like this: #!/usr/bin/perl opendir F, '.'; for $old (readdir(F)) { $new = $old; $new =~ s/([\x00-\x1f\x7f-\xff])/hex(ord($1))/e; rename $old, $new if $old != $new; } The shell is a fiddly place to be messing around with unprintables - if you use an 8-bit clean language that implements rename() or unlink(), your results will be more predictable. Mark