0

I need to copy all folders and files in directory, but I need to replace just files to another folder and delete source folder.

F.e.

core/     <---- OLD FOLDER (should be replaced with new version)

core/update/update_1.0.1/core <------- NEW VERSION

My idea was something like:

rename(realpath(ROOTPATH . 'core/'),realpath(ROOTPATH . 'core/update/update_1.0.1/core/');

//AFTER THAT

unlink(ROOTPATH . 'core/update/update_1.0.1/core/');

But with my code, actually I get the error: Access denied (code: 5)

Can anyone help? Thanks

  • possible duplicate https://stackoverflow.com/questions/2653803/rename-folder-into-sub-folder-with-php – geldek Dec 12 '19 at 09:11
  • Does this answer your question? [rename folder into sub-folder with PHP](https://stackoverflow.com/questions/2653803/rename-folder-into-sub-folder-with-php) – Gander Dec 12 '19 at 09:36
  • Hmm. my problem is not that the directory does not exist, but I do not have the premission to overriding the folder – rasslstudio Dec 12 '19 at 10:19

0 Answers0