req: New feature to rm? Remove file by the inode number

Raymond Wiker Raymond.Wiker at fast.no
Thu May 5 09:39:24 PDT 2005


Kamal R. Prasad writes:
 > 
 > > --- Raymond Wiker <Raymond.Wiker at fast.no> wrote:
 > > > Erik Udo writes:
 > > >  > 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 :)
 > > >  > 
 > > >  > I bet there is a way to remove those files, but
 > > > only
 > > >  > third party programs came to my mind.
 > > > 
 > > >         How about rm -i ./*?
 > > > 
 > The POSIX std requires -i to be used for 'interactive'
 > (and even if it didn't that is already the case on
 > most unix systems).

        That's exactly the way I meant this to be used... if you use
the command "rm -i ./*" you will be asked for each file whether you
want to remove it (except for files beginning with ".", of course).

        I don't see this as more cumbersome than using "ls -i" to get
a list of inodes, and then using clri or whatever to remove the inode;
which operation is probably the wrong solution anyway, as there may be
other directory entries that point to the same inode, and which should
be allowed to do so even after the unwanted directory entries have
been removed.



More information about the freebsd-hackers mailing list