09-28-04 10:56 PM
Maxim Heijndijk <cchq_nospam@wanadoo.nl> wrote:
> #!/bin/bash
>
> echo "Removing TRANS.TBL files..."
>
> FILES_1="`find ./ -name 'TRANS.TBL' -print`"
> FILES_2="`find ./ -name 'trans.tbl' -print`"
>
> for FILE in ${FILES_1} ${FILES_2}; do
>
> rm -v "${FILE}"
>
> done
>
> exit 0
>
>
> The above script cannot handle filenames with spaces, the for loop sees ev
ery string
> between spaces as a separate file:
>
> rm: cannot remove `./Software/Office_XP_2003/OUTLOOK': No such file or dir
ectory
> rm: cannot remove `WITH': No such file or directory
> rm: cannot remove `BCM/X86/TRANS.TBL': No such file or directory
>
> How do I fix this ?
Assuming there is no leading or tailing spaces,
find ./ -iname trans.tbl | while read f; do
rm "$f"
done
If there is, then play around with 'find -print0' and 'xargs -0 -n 1'.
--
William Park <opengeometry@yahoo.ca>
Open Geometry Consulting, Toronto, Canada
[ Post a follow-up to this message ]
|