diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-08-18 01:17:28 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-08-18 22:42:35 +0200 |
commit | 596246989217143d78e8987fa7b2c4154806a644 (patch) | |
tree | 03c4902cea3a35d00c703f422aead3c161795c63 /lib/archive.php | |
parent | d54390b1a0e7b36ef9b806e7b61f5ff9f85d190d (diff) | |
download | nextcloud-server-596246989217143d78e8987fa7b2c4154806a644.tar.gz nextcloud-server-596246989217143d78e8987fa7b2c4154806a644.zip |
add OC_Archive::addRecursive
Diffstat (limited to 'lib/archive.php')
-rw-r--r-- | lib/archive.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/archive.php b/lib/archive.php index 113f92e9604..fabd7cc7a51 100644 --- a/lib/archive.php +++ b/lib/archive.php @@ -112,4 +112,25 @@ abstract class OC_Archive{ * @return resource */ abstract function getStream($path,$mode); + /** + * add a folder and all it's content + * @param string $path + * @param string source + * @return bool + */ + function addRecursive($path,$source){ + if($dh=opendir($source)){ + $this->addFolder($path); + while($file=readdir($dh)){ + if($file=='.' or $file=='..'){ + continue; + } + if(is_dir($source.'/'.$file)){ + $this->addRecursive($path.'/'.$file,$source.'/'.$file); + }else{ + $this->addFile($path.'/'.$file,$source.'/'.$file); + } + } + } + } } |