I am unzipping some files and folders from an upload but the zip contains the files and folders one directory too deep. So currently they are located


When I need them to be located at


I have tried using the PHP rename function but get an error stating http 'wrapper does not support renaming in...'

Does anyone know the Drupal way to do this please

1 Answer 1


Sounds like you are trying to rename files by specifying their Url. You can't do that. You have to specify the path to the file. It's a PHP issue rather than a Drupal issue. Try this instead:

rename($_SERVER['DOCUMENT_ROOT'].'/path-to-folder/anotherdirectory/filename.ext', $_SERVER['DOCUMENT_ROOT'].'/path-to-folder/filename.ext');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.