protected function moveFilesIntoTargetFolder($sourcePath, $targetPath)
    {
        $filesystem = new \Symfony\Component\Filesystem\Filesystem();
        $filesystem->mirror($sourcePath, $targetPath);
        $finder     = new \Symfony\Component\Finder\Finder();
        $iterator   = $finder->files()->ignoreUnreadableDirs(true)->followLinks()->in($sourcePath);
        $sFiles     = [];
        foreach ($iterator as $file) {
            $relativePathFile = str_replace($sourcePath, '', $file->getRealPath());
            if (!file_exists($targetPath . $relativePathFile)) {
                $sFiles[$relativePathFile] = $targetPath . $relativePathFile;
            }
        }
        return $this->setArrayToJson($sFiles);
    }
protected function moveFilesIntoTargetFolder($sourcePath, $targetPath)
    {
        $filesystem = new \Symfony\Component\Filesystem\Filesystem();
        $filesystem->mirror($sourcePath, $targetPath);
        $finder     = new \Symfony\Component\Finder\Finder();
        $iterator   = $finder->files()->ignoreUnreadableDirs(true)->followLinks()->in($sourcePath);
        $sFiles     = [];
        foreach ($iterator as $file) {
            $relativePathFile = str_replace($sourcePath, '', $file->getRealPath());
            if (!file_exists($targetPath . $relativePathFile)) {
                $sFiles[$relativePathFile] = $targetPath . $relativePathFile;
            }
        }
        return $this->setArrayToJson($sFiles);
    }
protected function moveFilesIntoTargetFolder ( $ sourcePath , $ targetPath ) { $ filesystem = new \ Symfony \ Component \ Filesystem \ Filesystem ( ) ; $ filesystem -> mirror ( $ sourcePath , $ targetPath ) ; $ finder = new \ Symfony \ Component \ Finder \ Finder ( ) ; $ iterator = $ finder -> files ( ) -> ignoreUnreadableDirs ( true ) -> followLinks ( ) -> in ( $ sourcePath ) ; $ sFiles = [ ] ; foreach ( $ iterator as $ file ) { $ relativePathFile = str_replace ( $ sourcePath , '' , $ file -> getRealPath ( ) ) ; if ( ! file_exists ( $ targetPath . $ relativePathFile ) ) { $ sFiles [ $ relativePathFile ] = $ targetPath . $ relativePathFile ; } } return $ this -> setArrayToJson ( $ sFiles ) ; }
Moves files into another folder

@param string $sourcePath
@param string $targetPath
@return string
Moves files into another folder