Jump to content

PHP code to copy a folder tree


JorgeCarousel
 Share

Recommended Posts

Hey guys,

Does anybody have code to copy a whole folder tree with multiple levels?

I want to do something like this:

cp -fr /mnt/san1/src_folder/* /mnt/san2/dest_folder

Using PHP without having to do a foreach because there are multiple levels (188 folders in total)

Also, there are no files, only folders.

Thanks.

Link to comment
Share on other sites

2 hours ago, JorgeCarousel said:

Using PHP without having to do a foreach

2 hours ago, JorgeCarousel said:

because there are multiple levels (188 folders in total)

I don't see how those two are related.

Are you able to write a function that can copy just the files in a directory?

Link to comment
Share on other sites

You want to copy a folder tree that has no files in it at all to another place?  And once you have done that then what will you do with this new copy-of-a-similar-tree that also has no files in it?

Trying to get a feel for your problem and why you are in this position.

Link to comment
Share on other sites

OK so you are giving people access to a specific set of folders in your domain to save uploaded files to.   

1 - each user has their own sub-tree of these folders that only they will access?

2 - how do you control which of the folders each upload goes into?

3 - will others be able to see each others tree contents?

Link to comment
Share on other sites

This is a tree for jobs/projects, so it's a common area, all the users in the job/project will have access (R/W) to it and depending on what they are putting into it decides which folder it will go to and yes they all will be able to see what he others have put in them, this is not for private use, but for a company-wide file server, the tree will not be public and it's not located in the website's folder.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.