Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnews!ask From: ask@cbnews.cb.att.com (Arthur S. Kamlet) Newsgroups: comp.unix.shell Subject: Re: File remove command? Message-ID: <1991Jun15.210940.18999@cbnews.cb.att.com> Date: 15 Jun 91 21:09:40 GMT References: <3431@crdos1.crd.ge.COM> Reply-To: ask@cblph.att.com Distribution: na Organization: AT&T Bell Laboratories, Columbus, Ohio Lines: 36 In article <3431@crdos1.crd.ge.COM> davidsen@crdos1.crd.ge.com (bill davidsen) writes: >Has anyone written a remove command which will unlink all links to a >file inode when the command is issued on any one name? The heart of this command is to find the inumber; then remove all files in that filesystem with that inumber. For SVR3 Unixes - at least - you can find the inumber by an ls -lai $ ls -lai junk 397 -rw-r--r-- 1 ask user 571 Mar 5 15:07 junk So, you now want to remove all files with inumber 397 You need to know the root directory of your filesystem (use the /etc/mount or df command to find out if you are unsure) Then do a find and remove all occurences of that inumber $ cd /usrc # /usrc is the filesystem containing the files $ find . -inum 397 -exec rm {} \; Caution: inumbers are not unique in your system; only in your filesystem. So it's a very bad idea to do a find / -inum 397 ..... These are the basics; you might want to put these together in a script and add some tests. -- Art Kamlet a_s_kamlet@att.com AT&T Bell Laboratories, Columbus