private function removeFilesFromDir($dir)
    {
        if ($handle = opendir($dir)) {
            while (false !== ($entry = readdir($handle))) {
                if ($entry == "." || $entry == "..") {
                    continue;
                }

                if (!unlink($dir.DIRECTORY_SEPARATOR.$entry)) {
                    $this->putWarning("Can not remove: ".$dir.DIRECTORY_SEPARATOR.$entry);
                }
            }
            closedir($handle);
        }
    }