cleaning up

Michael Crawford mdcrawford at gmail.com
Mon Jan 11 17:55:53 PST 2010


If you're worried about losing your payload data, rather than having
find delete all the renamed files automatically, have it generate a
list of the renamed files that you redirect into a text file.  Examine
that file by eye, manually remove any lines containing files that you
don't want deleted, then delete the files named in the list by using
the backquote shell construction:

 $ find BLAH > deleteme.txt

(edit deleteme.txt, remove files that aren't to be deleted)

 $ rm `cat deleteme.txt`

note that those are backquotes and not apostrophes.

What backquotes do is run a command in a subshell, with its output
being placed on the command line.  If there are newlines in that
output, they are replaced with spaces, so multi-line output gets put
on just one line.

I'll send you my bill in the mail. :-D

Mike
-- 
Michael David Crawford
mdcrawford at gmail dot com

   GoingWare's Bag of Programming Tricks
      http://www.goingware.com/tips/


More information about the macports-dev mailing list