On Wed, 22 Jan 2003, Gael Mulat wrote:
> OK. If I summurize all that has been said, this problem is
> well-known but has no solution in a near future.
>
> But a workaround would be very useful for people (me and Brian
> Kelly, for instance) who use plenty of rm -rf in cross-platform shell
> scripts.
>
> Thanks to Shankar Unni, I have mine: I didn't noticed that only rm
> -rf had the trouble, and not rm -r.
>
> So my workaround will be to replace all the '/bin/rm -rf dir' by
> 'chmod -R +w dir; /bin/rm -r dir'. The semantic is not exactly the same
> (especially on write-protected directories), but that will allow my
> scripts to work well...
>
> Thanks everybody.
> Gael.
A suggestion:
'/bin/find dir -depth -exec /bin/chmod +w {} \; -exec /bin/rm -r {} \;'
might work, and will only parse the tree once... It will invoke chmod and
rm multiple times, though, but that's a tradeoff.
Igor