You have to set a flag on the RecursiveDirectoryIterator because by default, the current (".") and parent directory ("..") are included in the listing. This leads to an error message similar to "returned a path ".." that is not in the base directory".
To fix this, use "SKIP_DOTS":
<?php
new RecursiveDirectoryIterator(
$srcRoot, FilesystemIterator::SKIP_DOTS
);
?>