/**
  * Moves a $file into a $targetFolder
  * the target folder has to be part of this storage
  *
  * previously in t3lib_extFileFunc::func_move()
  *
  * @param \TYPO3\CMS\Core\Resource\FileInterface $file
  * @param \TYPO3\CMS\Core\Resource\Folder $targetFolder
  * @param string $conflictMode "overrideExistingFile", "renameNewFile", "cancel
  * @param string $targetFileName an optional destination fileName
  * @return \TYPO3\CMS\Core\Resource\FileInterface
  */
 public function moveFile($file, $targetFolder, $targetFileName = NULL, $conflictMode = 'renameNewFile')
 {
     $this->checkFileMovePermissions($file, $targetFolder);
     if ($targetFileName === NULL) {
         $targetFileName = $file->getName();
     }
     if ($targetFolder->hasFile($targetFileName)) {
         // File exists and we should abort, let's abort
         if ($conflictMode === 'renameNewFile') {
             $targetFileName = $this->getUniqueName($targetFolder, $targetFileName);
         } elseif ($conflictMode === 'cancel') {
             throw new \TYPO3\CMS\Core\Resource\Exception\ExistingTargetFileNameException('The target file already exists', 1329850997);
         }
     }
     $this->emitPreFileMoveSignal($file, $targetFolder);
     $sourceStorage = $file->getStorage();
     // Call driver method to move the file that also updates the file
     // object properties
     try {
         if ($sourceStorage == $this) {
             $newIdentifier = $this->driver->moveFileWithinStorage($file, $targetFolder, $targetFileName);
             $this->updateFile($file, $newIdentifier);
         } else {
             $tempPath = $file->getForLocalProcessing();
             $newIdentifier = $this->driver->addFileRaw($tempPath, $targetFolder, $targetFileName);
             $sourceStorage->driver->deleteFileRaw($file->getIdentifier());
             $this->updateFile($file, $newIdentifier, $this);
         }
     } catch (\TYPO3\CMS\Core\Exception $e) {
         echo $e->getMessage();
     }
     $this->emitPostFileMoveSignal($file, $targetFolder);
     return $file;
 }