We had a find ... xargs vs. File::Find discussion here before.
Your entire program can be written by find2perl in a much more
secure and efficient manner:
find2perl /top/dir -name '*.gz' -eval 'size > 1000000 and unlink' | pe
+rl
The GNU versions can handle the
"whitespace in the directory name" problems:
find / -name '*.gz' -size +1000k -print0 | xargs -0 rm -i
or
find / -name '*.gz' -size +1000k -print0 | xargs -0 -p -n 1 rm
Note the -print0 switch on the
find and the -0
switch on the xargs command.