PHP 8.2.30
Preview: copy_dir.php Size: 1.33 KB
//var/softaculous/akaunting/copy_dir.php

<?php 

@unlink('copy_dir.php');

$src = '[[srcpath]]/storage/app/uploads';
$dst = '[[softpath]]/storage/app/uploads';

function copy_r($path, $dest){
		
	// Is it a Directory ?
	if( is_dir($path) ){
		
		// Create the Destination Dir
		@mkdir($dest);
		
		$stat = stat($path);
		
		// Set the mode of the destination
		if(!empty($stat['mode'])){
			@chmod($dest, $stat['mode']);
		}
		
		// Set the UID
		if(!empty($stat['uid'])){
			@chown($dest, $stat['uid']);
		}
		
		// Set the GID
		if(!empty($stat['gid'])){
			@chgrp($dest, $stat['gid']);
		}
		
		// Start reading the current directory
		$objects = scandir($path);
		if( sizeof($objects) > 0 ){
			foreach( $objects as $file )
			{
				if( $file == "." || $file == ".." ){
					continue;
				}
				
				// Go on
				copy_r( $path.'/'.$file, $dest.'/'.$file );
			}
		}
		
		return true;
		
	}elseif( is_file($path) ){
		
		//To exclude some files if set in script's clone.php's __pre_unzip() function
		$ret = copy($path, $dest);
		$stat = stat($path);
		
		// Set the mode of the destination
		if(!empty($stat['mode'])){
			@chmod($dest, $stat['mode']);
		}
		
		// Set the UID
		if(!empty($stat['uid'])){
			@chown($dest, $stat['uid']);
		}
		
		// Set the GID
		if(!empty($stat['gid'])){
			@chgrp($dest, $stat['gid']);
		}
		
		return $ret;
		
	}else{
		return false;
	}
}

copy_r($src, $dst);

Directory Contents

Dirs: 6 × Files: 17

Name Size Perms Modified Actions
images DIR
- drwxr-xr-x 2025-12-15 22:03:02
Edit Download
php53 DIR
- drwxr-xr-x 2025-12-15 22:03:02
Edit Download
php56 DIR
- drwxr-xr-x 2025-12-15 22:03:02
Edit Download
php71 DIR
- drwxr-xr-x 2025-12-15 22:03:02
Edit Download
php81 DIR
- drwxr-xr-x 2025-12-15 22:03:02
Edit Download
php82 DIR
- drwxr-xr-x 2025-12-15 22:03:02
Edit Download
727 B lrw-r--r-- 2022-06-02 11:46:46
Edit Download
76.82 KB lrw-r--r-- 2025-12-15 08:28:26
Edit Download
71.74 MB lrw-r--r-- 2025-12-15 08:28:26
Edit Download
4.69 KB lrw-r--r-- 2025-12-15 12:17:50
Edit Download
1.33 KB lrw-r--r-- 2021-12-23 11:54:36
Edit Download
4.38 KB lrw-r--r-- 2025-12-15 12:17:50
Edit Download
447 B lrw-r--r-- 2021-12-23 11:54:36
Edit Download
9.97 KB lrw-r--r-- 2025-12-15 12:17:50
Edit Download
254 B lrw-r--r-- 2025-02-17 09:42:34
Edit Download
3.52 KB lrw-r--r-- 2025-12-15 12:17:50
Edit Download
5.31 KB lrw-r--r-- 2025-12-15 08:28:26
Edit Download
921 B lrw-r--r-- 2021-12-23 11:54:36
Edit Download
4.19 KB lrw-r--r-- 2025-12-15 12:17:50
Edit Download
2.94 KB lrw-r--r-- 2022-06-27 12:19:40
Edit Download
1.99 KB lrw-r--r-- 2025-12-15 12:17:50
Edit Download
722 B lrw-r--r-- 2023-10-09 10:53:50
Edit Download
555 B lrw-r--r-- 2021-12-23 11:54:36
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).