Esempio n. 1
0
function recursiveCopy($filename, $initialfolder, $targetfolder)
{
    $badfiles = ['vendor', 'node_modules', '.DS_Store', 'sftp-config.json', '.git', '.gitignore', 'build.sh'];
    foreach (Folder::items($initialfolder . '/' . $filename, false, Folder::PATH_BASENAME) as $item) {
        if (!in_array($item, $badfiles)) {
            if (is_dir($initialfolder . '/' . $filename . '/' . $item)) {
                recursiveCopy($item, $initialfolder . '/' . $filename, $targetfolder . '/' . $filename);
            } else {
                File::copy($initialfolder . '/' . $filename . '/' . $item, $targetfolder . '/' . $filename . '/' . $item);
            }
        }
    }
}
Esempio n. 2
0
 /**
  * Method to test items().
  *
  * @return void
  *
  * @covers Windwalker\Filesystem\Folder::items
  */
 public function testItems()
 {
     $items = Folder::items(static::$dest . '/folder1/level2', true);
     $this->assertEquals(FilesystemTestHelper::cleanPaths(array(static::$dest . '/folder1/level2/file3')), FilesystemTestHelper::cleanPaths($items));
     // No full name
     $items = Folder::items(static::$dest . '/folder1/level2', true, Folder::PATH_BASENAME);
     $this->assertEquals(FilesystemTestHelper::cleanPaths(array('file3')), FilesystemTestHelper::cleanPaths($items));
     // Recursive
     $items = Folder::items(static::$dest, true, Folder::PATH_ABSOLUTE);
     $compare = FilesystemTestHelper::getItemsRecursive('dest');
     $this->assertEquals(FilesystemTestHelper::cleanPaths($compare), FilesystemTestHelper::cleanPaths($items));
 }