View Single Post
Old 08-05-2005, 01:19 PM   #2 (permalink)
jaswinder_rana
The Acquainted
 
Join Date: May 2005
Posts: 106
Thanks: 0
jaswinder_rana is on a distinguished road
Default

you have to create directories to do that and copy all the contents there, something similar to cpanel which copies skeleton when a new account is created.

you can create a template directory which will have all the files needed to do whateever you are doing.
then when you create account, you only have to do is create a directory by that name and then copy all of the folders in that template directory to the new one.

ofcourse there isn't a comand to copy all folders at once, and i had to do the similar thing, then i got a little function from somebody which recursively copies the whole directory to another one. i'l post it here hoping to help you out

and i wont take credit for this as i am just using it and it is written by somebody else.. you can find info about the person in the comments
PHP Code:
/**
     * Copy a file, or recursively copy a folder and its contents
     *
     * @author      Aidan Lister <aidan@php.net>
     * @version     1.0.1
     * @param       string   $source    Source path
     * @param       string   $dest      Destination path
     * @return      bool     Returns TRUE on success, FALSE on failure
     */
    
function copyr($source$dest)
    {
        
// Simple copy for a file
        
if (is_file($source)) {
            return 
copy($source$dest);
        }
     
        
// Make destination directory
        
if (!is_dir($dest)) {
            
mkdir($dest);
        }
     
        
// Loop through the folder
        
$dir dir($source);
        if(
$dir)
        {
            while (
false !== ($entry $dir->read())) {
                
// Skip pointers
                
if ($entry == '.' || $entry == '..') {
                    continue;
                }
         
                
// Deep copy directories
                
if ($dest !== "$source/$entry") {
                    
copyr("$source/$entry""$dest/$entry");
                }
            }
            
// Clean up
            
$dir->close();
        }
     
        
        return 
true;
    } 
__________________
---------------------------
Errors = Improved Programming.
Portfolio
Send a message via MSN to jaswinder_rana
jaswinder_rana is offline  
Reply With Quote