Oookay! Yes it was an issue with the returns. They did confuse me a little when I first found the script but everyone else using it said it worked. This works for me:
chmod("1", 0777);
chmod("1/images", 0777);
chmod("1/scripts", 0777);
chmod("1/uploads", 0777);
$path = "1";
if (is_dir($path) === true) {
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path) , RecursiveIteratorIterator::CHILD_FIRST);
foreach($files as $file) {
if (in_array($file->getBasename() , array(
'.',
'..'
)) !== true) {
if ($file->isDir() === true) {
rmdir($file->getPathName());
}
else if (($file->isFile() === true) || ($file->isLink() === true)) {
unlink($file->getPathname());
}
}
}
rmdir($path);
}
else if ((is_file($path) === true) || (is_link($path) === true)) {
unlink($path);
}
Basically removed the returns and removed the end return false.
Pretty sure this is fine now but if you can see any issues please let me know, but if not thanks for the help Nock! (: