/** * Recursive function deleting a directory * * @param string $path The path of the directory to remove recursively * @param boolean $deleteParent If the path must be deleted too * @param array $except filenames and suffix of filename, for files to NOT delete * @since 1.0b1 * @author Loic Mathaud * @return boolean true if all the content has been removed */ public static function removeDir($path, $deleteParent = true, $except = array()) { if (is_array($except) && count($except)) { return Directory::removeExcept($path, $except, $deleteParent); } else { return Directory::remove($path, $deleteParent); } }
public function removeDir($dir) { if (!file_exists($this->rootPath . $dir)) { //echo "cannot remove $dir. It doesn't exist.\n"; return false; } \Jelix\FileUtilities\Directory::remove($this->rootPath . $dir); return true; }
exit(1); } array_shift($_SERVER['argv']); // shift the script name $restrictedDirectory = ''; $options = array('verbose' => false); if (substr($_SERVER['argv'][0], 0, 1) == '-') { $sw = substr(array_shift($_SERVER['argv']), 1); $options['verbose'] = strpos($sw, 'v') !== false; if (strpos($sw, 'd') !== false) { $restrictedDirectory = array_shift($_SERVER['argv']); } } list($sourcefile, $distfile) = $_SERVER['argv']; if ($restrictedDirectory != '') { $s = realpath($sourcefile); if (strpos($s, $restrictedDirectory) !== 0) { exit(1); } } try { $proc = new \Jelix\BuildTools\PreProcessor\PreProcessor(); $proc->setVars($_SERVER); $dist = $proc->parseFile($sourcefile); } catch (Exception $e) { echo $e; exit(1); } \Jelix\FileUtilities\Directory::create(dirname($distfile)); file_put_contents($distfile, $dist); exit(0);
public function createDir($dir) { return \Jelix\FileUtilities\Directory::create($this->rootPath . $dir); }
/** * Recursive function deleting a directory. * * @param string $path The path of the directory to remove recursively * @param bool $deleteParent If the path must be deleted too * @deprecated */ public static function removeDir($path, $deleteParent = true) { return Directory::remove($path, $deleteParent); }