Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!icdoc!qmw-cs!liam From: liam@cs.qmw.ac.uk (William Roberts) Newsgroups: comp.unix.aux Subject: Hint on removing strange files Summary: Use find with -exec rm Keywords: weird filenames, disinfectant Message-ID: <2550@sequent.cs.qmw.ac.uk> Date: 24 Jul 90 09:05:04 GMT Organization: Computer Science Dept, QMW, University of London, UK. Lines: 44 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)