Better here to create a var for $dest . '/' . $iterator->getSubPathName() and use it with realpath(), mkdir() and copy()