my( $uid, $gid ) = (stat $i)[4,5]; copy "from/$i", "$to/$i"; chown $uid, $gid, "$to/$i" or die "chown $to/$i (uid=$uid, gid=$gid) failed: $!";