public function delTree($dir, $must_be_empty = true)
	{
		$this->debug->groupCollapsed(__CLASS__.'->'.__FUNCTION__, $dir);
		$cfg = $this->cfg;
		$dir = str_replace($cfg['ds_replace'], $cfg['ds'], $dir);
		if (substr($dir, -1) != $cfg['ds']) {
			$dir .= $cfg['ds'];		// add ending slash if not present
		}
		if (!file_exists($dir)) {
			$this->debug->log('does not exist');
			$return = 1;
		} elseif (is_dir($dir)) {
			$files = glob($dir.'*');
			$children = false;
			foreach ($files as $file) {
				#$this->debug->log('file', $file);
				$return = -1;
				if (is_dir($file)) {
					$return = call_user_func(array($this, __FUNCTION__), $file, $must_be_empty);
				} elseif (!$must_be_empty) {
					$return = unlink($file);
				}
				#$this->debug->log('return', $return);
				if ($return < 1) {
					$children = true;
				}
			}
			#$this->debug->log('children', $children);
			$return = -1;
			if (!$children) {
				$this->debug->log('no children...remove the dir');
				$return = rmdir($dir);
			}
		} else {
			$this->debug->log('exists, but not a dir');
			$return = 0;
		}
	    #$this->debug->log('return', $return);
	    $this->debug->groupEnd();
	    return $return;
	}