diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-11-27 11:23:55 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-11-27 11:23:55 -0500 |
commit | fb0380f48203a11584773f3db335eaadd9cc6fdf (patch) | |
tree | 98f7eb36ed8a3ec99c1cba5c9c0742af8931783b /shell/bin/cp.php | |
parent | 3d6790614bb0dc776e02a95835e5c274263d1d1a (diff) |
This zip file was identified as ltshell-3.5.zip
Diffstat (limited to 'shell/bin/cp.php')
-rw-r--r-- | shell/bin/cp.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/shell/bin/cp.php b/shell/bin/cp.php new file mode 100644 index 0000000..4a6cfae --- /dev/null +++ b/shell/bin/cp.php @@ -0,0 +1,33 @@ +<?php +class p_cp extends prog { + /* This method (recurse_copy) was written by gimmicklessgpt@gmail.com + * and posted to the PHP manual comments section on 20-May-2009 11:04 + */ + function recurse_copy($src,$dst) { + $dir = opendir($src); + @mkdir($dst); + while(false !== ( $file = readdir($dir)) ) { + if (( $file != '.' ) && ( $file != '..' )) { + if ( is_dir($src . '/' . $file) ) { + recurse_copy($src . '/' . $file,$dst . '/' . $file); + } + else { + copy($src . '/' . $file,$dst . '/' . $file); + } + } + } + closedir($dir); + } + + public static function main($args, $env) { + $me = array_shift($args); + $flags = ''; + while (strstr($args[0],0,1) == '-') { + $flags .= array_shift($args); + } + $flags = preg_replace('/[ -]/','',$flags); + if (strpos($flags,'r')===false) { copy($args[0],$args[1]); } + else { recurse_copy($args[0],$args[1]); } + } +} + |