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

Simon Roberts thorpflyer at yahoo.com
Thu May 5 09:00:34 PDT 2005


A couple of observations:

1) Implicit in most people's answers is the fact that
a single inode can have many directory entries. That's
why find is used. That's also why the solution below
won't work, as it doesn't check the entire file system
(nor would you want to answer y/n for all those files
:)

2) The same inode number can exist for multiple files
in a system. This occurs if multiple file systems
exist. So, if you use find to achieve the desired
effect, be very sure that you run it from the root of
the target file system and that you tell it not to
traverse onto other file systems. If you run it from
the root directory, you're very likely to delete one
or more files you didn't mean to delete.

Point 2, likely as not, might explain why there's no
simple mechanism for doing this from rm. At the very
least you'd have to specify the file system you're
referring to, and many "plain" users couldn't do that
safely. Those that can are probably able to use find
anyway.

Cheers,
Simon


--- 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 ./*?
> 
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
>
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to
> "freebsd-hackers-unsubscribe at freebsd.org"
> 


		
__________________________________ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 


More information about the freebsd-hackers mailing list