/**
  * Performs an export of files according to the given FTP configuration.
  *
  * @param array $ftp Import/export configuration (from DB record)
  * @throws ImportExportException
  * @return bool Result of the action
  */
 public function exportAction($ftp)
 {
     // Create the necessary drivers
     $this->fromDriver = GeneralUtility::makeInstance('Cobweb\\Ftpimportexport\\Driver\\LocalDriver');
     $this->toDriver = GeneralUtility::makeInstance('Cobweb\\Ftpimportexport\\Driver\\FtpDriver');
     $this->toDriver->connect($ftp);
     // Validate source path. This may throw an exception, but we let it bubble up.
     $sourcePath = $this->fromDriver->validatePath($ftp['source_path']);
     // Check that path is allowed
     if (!$this->isValidExportPath($sourcePath)) {
         throw new ImportExportException(sprintf('Invalid export path (%s)', $sourcePath), 1387272483);
     }
     // Validate target path and make sure it exists
     $targetPath = $this->toDriver->validatePath($ftp['target_path']);
     $this->toDriver->createDirectory($targetPath);
     if ($this->fromDriver->changeDirectory($sourcePath)) {
         $transferredFiles = $this->putAllFiles($sourcePath, $targetPath, '', $ftp['recursive']);
         // Apply post-processing, if relevant
         if (!empty($ftp['post_processing']) && count($transferredFiles) > 0) {
             $this->postProcessAction($this->fromDriver, $transferredFiles, $ftp);
         }
     } else {
         if ($this->extensionConfiguration['debug']) {
             $message = 'Could not change to directory: ' . $sourcePath;
             GeneralUtility::devLog($message, 'ftpimportexport', 3);
             throw new ImportExportException($message, 1387272483);
         }
     }
     return TRUE;
 }