\begin{[EMAIL PROTECTED]}
> On Fri, Nov 02, 2001 at 05:10:54PM +1100, Andrew Foster wrote:
> >     thing.mp3
> >     pants.txt
> >     yer.rtf
> >     others.html
> > These files do exist on my system, except they're scattered throughout a
> > directory tree hierachy, and there's no path info in my text file to say
> > where. 
> 
> To perform all the deleting in one traversal of the filesystem(s) and
> fork'and'exec a single rm ...
> 
> file=filelist args= ; cat $file | while read line
> do
>     [[ -z $args ]] && args="-name $line" || args="$args -o -name $line"
> done
> eval "find . $args | xargs rm"

(couldn't help myself ;)

args=-false
while read line; do args="$args -o -name $line"; done < filelist
find . $args -print | xargs rm

or even:
find . -false `sed 's/^/-o -name /' filelist` -print | xargs rm

(of course, if you're using GNU tools, then the above should both be:
  find ... -print0 | xargs -0 rm
 to make sure you survive paths with whitespace, etc in them)


or if your locatedb is up to scratch:

while read line; do args="$args */$line"; done < filelist
locate $args | xargs rm

or even:
locate `sed 's,^,*/,' filelist` | xargs rm

-- 
 - Gus

-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to