move - How do I copy a folder structure with only modified files on GIT? -
i have repository big folder structure , lot of files. need take modified files without commit , copy folder, same folder structure.
have done that?
i've solve simple php code, when run it, changed file copied on patch folder.
$dir = dirname(file) . "/"; $patch = dirname(file) . "/patch/";
cp($dir, "", $patch);
function cp($dir, $file, $patch) {
if ($file == "patch" || $file == "index.php") return; if (is_dir($dir . $file)) { $patch = $patch . $file . "/"; $dir = $dir . $file . "/"; $files = scandir($dir); foreach ($files $file) { if ($file != "." && $file != "..") { cp($dir, $file, $patch); } } } else { $t = mktime(0, 0, 0, date("m"), date("d"), date("y")); if (filemtime($dir . $file) > $t) { if (!file_exists($patch)) mkdir($patch, 0777, true); copy($dir . $file, $patch . $file); } }
}
Comments
Post a Comment