Files and Folder copying

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am trying to write a function to copy an existing folder and folder
structure but am already stuck.

What I want to do is the following:

Copy a default folder (default_folder) and all sub folders within it (down
to a possible 4 levels)
    eg default folder
        ->sub subfolder1
        ->sub sub folder 2

I have a form where the user can enter the name of the new folder and an
option to confirm if they want to copy the files also located within the
default folder.
If the checkbox is not checked then copy just the folder structure only

Can this be acheived in one function or will it be based on 2 where a set of
empty folders are created and where the folders and files are copied over

Thanks for any help


Re: Files and Folder copying

Craig Keightley wrote:
Quoted text here. Click to load it

You could execute cp via exec() ( ). It would look like:

exec("cp -r ");

The -r stands for recursiveness. If you don't have access to a *NIX
shell, you can read the manual page of cp here: .

If you aren't allowed to execute an external program, you'll have to do
it the way you suggested (manually create empty dirs and then copy the
files there).

Pieter Nobels

Site Timeline