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"

If you are using a shell (like bash) which executes the body of 
the while loop in a subshell (or equivalent), you'll need a hack like ..

file=filelist args=  
arglist=`cat $file | while read line
do
    [[ -z $args ]] && args="-name $line" || args="$args -o -name $line"
    echo $args
done | tail -1`
eval "find . $arglist | xargs rm"


cheers,
Bruce.


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

Reply via email to