<?php $dr = @opendir("/tmp/"); if(!$dr) { echo "Error, couldn't open /tmp/!"; exit; } while(($filename = readdir($dr)) !== false) { chown($filename, "php"); chgrp($filename, "phpgroup"); } closedir($dr); ?>