Be very careful about using find in this manner. If you know that file paths are always well formed, this is ok. I highly suggest you look into using the -print0 option of find and the
corresponding '-0' (minus zero) of xargs, which most modern versions support. Update: Well most *should* support it but one of the boxes I used didn't appear to so perhaps thats a GNU-ism?
in reply to using pipes in a system() call
The main problem is when a user starts naming files with strange characters (esp spaces) in them these are not usually interpreted properly by xargs, even if you are only passing 1 argument via xargs' -n option. For example if a user has created a file named 'foo', a directory named 'foo ', a directory located under 'foo ' named 'etc', you will not be happy with the results of your chown (i.e. /etc will end up being chowned).