[comp.unix.xenix] need help for SCO Xenix Sys V 286. ver 2.1.3

ch-tkr@wasatch.utah.edu (Timothy K Reynolds) (04/29/89)

I need some help!  Please.  We have Xenix from SCO version 2.1.3 Sys V for
the IBM PCAT.  This version is no longer supported by SCO.  (they want us
to buy an upgrade before they will give us support)  We have a cheap boss,...
so this ain't gonna happen.

My Problem:  we are removing some old users from the system.  But we can't
clean their directories due to some odd files which still exist.  The files
apparently have non-ascii characters in them (as determined by "ls > tmp"
and trying to edit tmp in vi.

Anybody out there know how to get around this problem?  I would really
appreciate your help with this matter.

Thanx in advance.

e-mail to: ch-tkr@wasatch.utah.edu

ked@garnet.berkeley.edu (Earl H. Kinmonth) (04/29/89)

In article <1689@wasatch.utah.edu> ch-tkr@wasatch.utah.edu (Timothy K Reynolds) writes:

>My Problem:  we are removing some old users from the system.  But we can't
>clean their directories due to some odd files which still exist.  The files
>apparently have non-ascii characters in them (as determined by "ls > tmp"
>and trying to edit tmp in vi.
>
>Anybody out there know how to get around this problem?  I would really
>appreciate your help with this matter.

One way is to pipe the output of find into a simple program that unlinks
files as in

find . -type f -print | zapcrap

where the program zapcrap is

#include	<stdio.h>
char	ls[BUFSIZ];
main()
{
	while(gets(ls))	unlink(ls);
}


Earl H. Kinmonth
History Department
University of California, Davis
916-752-1636 (voice, fax [2300-0800 PDT])
916-752-0776 secretary

ucbvax!ucdavis!ucdked!cck

bill@bilver.UUCP (bill vermillion) (04/30/89)

In article <23770@agate.BERKELEY.EDU> ked@garnet.berkeley.edu (Earl H. Kinmonth) writes:
>In article <1689@wasatch.utah.edu> ch-tkr@wasatch.utah.edu (Timothy K Reynolds) writes:
>
>>My Problem: ... But we can't clean ... due to some odd files which still exist
>>
>>Anybody out there know how to get around this problem?  I would really
>>appreciate your help with this matter.
>
>One way is to pipe the output of find into a simple program that unlinks
>files as in
>
>find . -type f -print | zapcrap
>
.... (program deleted - wjv)

Since he is running SCO Xenix, he can use a find parameter which has been
around since the first Xenix port from version 7, but has been undocumented
(in the manuals I have seen) since Xenix 2.   (Or was that Xenix II ?)

The parameter is inum.  (do a strings on /bin/find and it is there).

Go to the offending directory.  Do   ls -lai  .  This will show you all the
files with their inumber in the first colum.  Then it is as simple as

find . -inum xxx -print -exec rm {} \;

You don't need the print statement, but I like to see what is going on.

bill
-- 
Bill Vermillion - UUCP: {uiucuxc,hoptoad,petsd}!peora!rtmvax!bilver!bill
                      : bill@bilver.UUCP

jim@tiamat.fsc.com (Jim O'Connor) (05/01/89)

In article <23770@agate.BERKELEY.EDU>, ked@garnet.berkeley.edu (Earl H. Kinmonth) writes:
> In article <1689@wasatch.utah.edu> ch-tkr@wasatch.utah.edu (Timothy K Reynolds) writes:
> 
> >My Problem:  we are removing some old users from the system.  But we can't
> >clean their directories due to some odd files which still exist.  The files
> >apparently have non-ascii characters in them (as determined by "ls > tmp"
> >and trying to edit tmp in vi.
> 
> One way is to pipe the output of find into a simple program that unlinks
> files as in

Also, if you want to get rid of the entire directory any, as "root" do

# rm -rf directory_name

This will get rid of all files in the driectory, plus the directory itself,
regardless of what the files in the directory are named.

Good luck.
------------- 
James B. O'Connor			jim@tiamat.fsc.com
Filtration Sciences Corporation		615/821-4022 x. 651

*** Altos users unite! mail to "info-altos-request@tiamat.fsc.com" ***

ked@garnet.berkeley.edu (Earl H. Kinmonth) (05/01/89)

>find . -inum xxx -print -exec rm {} \;

The solution you describe will fail in several cases.  If the odd file
names begin with a hyphen, they will usually be treated as options for
rm.  Depending on what the offending name is, you may get more than you
wanted or nothing.

The solution you describe will fail if the file name contains blanks,
tabs, newlines, or carriage returns.  I have had several cases of
programs producing file names with ^M in them.  Since exec forks a
shell, the ^M will be removed and rm will not see the proper file name.

The simplest way to get rid of all weird names is the one I originally

Earl H. Kinmonth
History Department
University of California, Davis
916-752-1636 (voice, fax [2300-0800 PDT])
916-752-0776 secretary

ucbvax!ucdavis!ucdked!cck
proposed.  unlink() will take any string literally.  An amateur C
programmer with unitialized pointers can produce file names with almost
anything in them....  (I know from experience.)

chris@utgard.UUCP (Chris Anderson) (05/02/89)

In article <1689@wasatch.utah.edu> ch-tkr@wasatch.utah.edu (Timothy K Reynolds) writes:
>My Problem:  we are removing some old users from the system.  But we can't
>clean their directories due to some odd files which still exist.  The files
>apparently have non-ascii characters in them (as determined by "ls > tmp"
>and trying to edit tmp in vi.
>
>Anybody out there know how to get around this problem?  I would really
>appreciate your help with this matter.

Another way is to do "rm -i *" and then answer y/n for each file
that you want to keep or not keep.

The "find" method is the cleanest, however :-).



Chris
-- 
| Chris Anderson, 						       |
| QMA, Inc.		        email : {csusac,sactoh0}!utgard!chris  |
|----------------------------------------------------------------------|
| Of *course* I speak for my employer, would he have it any other way? |

ked@garnet.berkeley.edu (Earl H. Kinmonth) (05/02/89)

>

Won't work if the file name is -i followed by certain chracters.