Posts Tagged ‘for php 4x’

Moving contents from one folder to another

October 25th, 2006 No comments

We always try to store images in a web path where heavy image linking is needed, and mostly the images will be categorised in some sort of directory tree.. to limit the no of files in a folder.

Once editing, for example, re assinging a set of students from one scientist to another, was needed, and the hell, we had to face.. finally the following piece of code was written, for a future reuse.

function mkdir_r($dirName$rights=0777){
$dirs explode('/'$dirName);
        foreach (
$dirs as $part) {
        if (!
is_dir($dir) && strlen($dir)>0)
xMove($source$target$drop true){
is_dir($source)) return false;
is_dir($target)) mkdir_r($target);
$d dir($source);
        while (
false !== ($entry $d->read())) {
copy($source "/$entry"$target "/$entry");
unlink($source "/$entry");

If any body is wondering (just a thought) how I have managed the colour highlighting, then better take a look at Phpizer Plugin