/**
  *  This function creates a directory or an array of directories at the
  *  target directory.
  *
  *  @param  $directories  The directory name or an array of directories names
  *                        relative to the target directory.
  *  @param  $mode         (optional) Default: 0700.
  *
  *  @returns     An array with the results.
  */
 function createDirectory($directories, $mode = 0700)
 {
     if (!is_array($directories)) {
         $directories = array($directories);
     }
     $res = array();
     foreach ($directories as $directory) {
         // Target directory
         $directory = YDPath::join($this->_target_dir, $directory);
         // If already defined, continue to next directory
         if (is_dir($directory)) {
             $res[] = array('success' => false, 'action' => 'create', 'type' => 'directory', 'item' => $directory, 'reason' => 'exist');
             if ($this->_log) {
                 YDLog::warning('Creating directory: ' . $directory . ' - already exist');
             }
             continue;
         }
         // Get the parent directory
         $d = new YDFSDirectory(YDPath::getDirectoryName($directory));
         if (!($success = $d->createDirectory($directory))) {
             if ($this->_log) {
                 YDLog::error('Creating directory: ' . $directory);
             }
         } else {
             if ($this->_log) {
                 YDLog::info('Creating directory: ' . $directory);
             }
         }
         $res[] = array('success' => $success, 'action' => 'create', 'type' => 'directory', 'item' => $directory, 'reason' => 'failure');
     }
     return $res;
 }