function test_cp_with_exclude() { $this->_create_file_system(); $res = dir :: cp(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow', TEST_DIR_ABSOLUTE_PATH . '/tmp/cp', false, '/hey/'); sort($res); $this->assertEqual( $res, array('test2_1', 'test2_2', 'test2_3') ); $this->assertEqual( $res, dir :: ls(TEST_DIR_ABSOLUTE_PATH . '/tmp/cp/') ); $this->assertFalse(is_dir(TEST_DIR_ABSOLUTE_PATH . '/tmp/cp/hey')); $this->_remove_file_system(); }
function cp($src, $dest) { dir::mkdir($dest, 0777); $arr = dir::ls($src); $separator = dir::separator(); foreach ($arr as $fn) { if ($fn) { $fl = "{$src}{$separator}{$fn}"; $flto = "{$dest}{$separator}{$fn}"; if (is_dir($fl)) { dir::cp($fl, $flto); } else { copy($fl, $flto); } } } }