Unexpected '{' with IF statement
- by user1926208
this is my code to move all the files in a directory to another directory which are 1 hour old or more.
<?php
$srcDir = 'code';
$destDir = 'code/old';
if (file_exists($destDir)) {
if (is_dir($destDir)) {
if (is_writable($destDir)) {
if ($handle = opendir($srcDir)) {
while (false !== ($file = readdir($handle))) {
if (is_file($srcDir . '/' . $file)) {
if(date("U",filectime($srcDir . '/' . $file) >= time() - 3600) {
rename($srcDir . '/' . $file, $destDir . '/' . $file);
}
}
}
closedir($handle);
} else {
echo "$srcDir could not be opened.\n";
}
} else {
echo "$destDir is not writable!\n";
}
} else {
echo "$destDir is not a directory!\n";
}
} else {
echo "$destDir does not exist\n";
}
?>
and I am getting this error:
Parse error: syntax error, unexpected '{' in /home/tcity/public_html/myDir/movefiles.php on line 11