[comp.unix.aux] Hint on removing strange files

liam@cs.qmw.ac.uk (William Roberts) (07/24/90)

Lots of Mac programs produce exotic filenames containing things
like trademark symbols, those curly Fs that people use to
denote folders and so on. A recent case in point is the INIT
that Disinfectant 2.0 installs in your System Folder, which is
called "X Disinfectant INIT" where X is a diamond character (\327)

The A/UX shells are not 8-bit clean, so they strip off the top
bit, hence

        echo *Disinf*
gives   W Disinfectant INIT

So how do you remove the file that is causing your Mac session
to crash when it loads in this init?

Answer, find a way of passing the filename to rm without having
the shell process it first. The method I came up with is

        find . -name "*Disinf*" -exec rm -i - {} \;

Translated into English this is

find    search for things
.       in the current directory and its subdirectories
-name   whose name matches the pattern
"*Disinf*"      pattern (in quotes so that the shell leaves it alone)
-exec   for any matching file, execute the command
rm      rm
-i      interactive (i.e. prompts for yes/no with each file)
-       all following arguments to rm are filenames
{}      the name of the matching file
\;      that's all (the \ prevents the shell from stealing the ;)

The important bit is that {} is passed from find directly to
the rm command without going through the annoying "strip the
parity bit" that csh insists on. Csh and tcsh fans can probably
make an alias which does this, and sh lovers will naturally
write a shell function for it.
-- 

William Roberts                 ARPA: liam@cs.qmw.ac.uk
Queen Mary & Westfield College  UUCP: liam@qmw-cs.UUCP
Mile End Road                   AppleLink: UK0087
LONDON, E1 4NS, UK              Tel:  071-975 5250 (Fax: 081-980 6533)

beard@ux5.lbl.gov (Patrick C Beard) (08/15/90)

In article <2550@sequent.cs.qmw.ac.uk> liam@cs.qmw.ac.uk (William Roberts) writes:
#Lots of Mac programs produce exotic filenames containing things
#like trademark symbols, those curly Fs that people use to
#denote folders and so on. A recent case in point is the INIT
#that Disinfectant 2.0 installs in your System Folder, which is
#called "X Disinfectant INIT" where X is a diamond character (\327)
#
#The A/UX shells are not 8-bit clean, so they strip off the top
#bit, hence
#
#        echo *Disinf*
#gives   W Disinfectant INIT
#
#So how do you remove the file that is causing your Mac session
#to crash when it loads in this init?

Your answer is quite helpful, and I will  use it in the future, but
I didn't know it when I needed to get back up and running.  What I ended
up  doing was to use Macsbug to break  on OpenResFile inside INIT 31.  When
the failing  INIT file (Suitcase* II, * stands for option-2) was opened,
I set ResErr to -1 so INIT 31  wouldn't load any INITs from it.  This worked.

--
-------------------------------------------------------------------------------
-  Patrick Beard, Macintosh Programmer                        (beard@lbl.gov) -
-  Berkeley Systems, Inc.  ".......<dead air>.......Good day!" - Paul Harvey  -
-------------------------------------------------------------------------------