From owner-freebsd-hackers@FreeBSD.ORG Thu May 5 20:02:06 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4F76716A4CE for ; Thu, 5 May 2005 20:02:06 +0000 (GMT) Received: from smtp4.server.rpi.edu (smtp4.server.rpi.edu [128.113.2.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id C71FD43D55 for ; Thu, 5 May 2005 20:02:05 +0000 (GMT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp4.server.rpi.edu (8.13.0/8.13.0) with ESMTP id j45K23c0010661 for ; Thu, 5 May 2005 16:02:04 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: <427A014D.6020809@dnainternet.net> References: <427A014D.6020809@dnainternet.net> Date: Thu, 5 May 2005 16:02:02 -0400 To: freebsd-hackers@freebsd.org From: Garance A Drosihn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-CanItPRO-Stream: default X-RPI-SA-Score: undef - spam-scanning disabled X-Scanned-By: CanIt (www . canit . ca) on 128.113.2.4 Subject: Re: req: New feature to rm? Remove file by the inode number X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2005 20:02:06 -0000 At 2:19 PM +0300 5/5/05, Erik Udo wrote: >I couldn't find a way to remove files that had scandic/non-printable >letters, then i remembered ls showed inode number of the file. Is it >possible to remove the file by the inode number? It would be a >useful feature :) It would be a bad feature, at least for the problem you are trying to solve. You are trying to remove one specific filename from one specific directory. It is possible to link multiple filenames to the exact same file (inode). If a file has multiple links to it, then you would want to remove only the filename you're looking at, and not all filenames in the filesystem which might have the same inode. Other solutions, with 'find' or 'rm -i ./*', are more correct for the situation you are looking at. Note that if a file only has *some* unprintable characters, and also has some standard characters, then you can use pattern-matching to reduce how many fines would be matched by 'rm -i'. Something like: rm -i ./*blah* I have been in similar situations to what you're describing, and I've never had to do more than pick a reasonable filename pattern and combine it with -i (-i for "interactive", so it prompts you for each file before removing it). -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu