Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 May 2005 16:02:02 -0400
From:      Garance A Drosihn <drosih@rpi.edu>
To:        freebsd-hackers@freebsd.org
Subject:   Re: req: New feature to rm? Remove file by the inode number
Message-ID:  <p06210233bea02b1da089@[128.113.24.47]>
In-Reply-To: <427A014D.6020809@dnainternet.net>
References:  <427A014D.6020809@dnainternet.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p06210233bea02b1da089>