loganbest Posted December 21, 2007 Share Posted December 21, 2007 I'm wanting to copy a complete directory from one location to another with this script: $DOCUMENT_ROOT=$HTTP_SERVER_VARS['DOCUMENT_ROOT']; $startletter = $username{0}; $oldletter = $oldid{0}; $getroot = "/home/whatego/public_html"; @mkdir("/home/whatego/public_html/user_pics/$startletter"); @mkdir("/home/whatego/public_html/user_pics/$startletter/$newid"); $newfolder = "/home/whatego/public_html/user_pics/$startletter/$newid"; $oldfolder = "/home/whatego/public_html/user_pics/$oldletter/$oldid"; $good = copy($oldfolder,$newfolder); if ($good) {echo'Moving pictures success'; } else { echo'Moving pictures failed!';} I always get this error: Warning: copy(/home/whatego/public_html/user_pics/7/7) [function.copy]: failed to open stream: Is a directory in /home/whatego/public_html/changeuser.php on line 89 Moving pictures failed! the copy() manual on php.net said ti would overwrite everything in that directory, though it's not Quote Link to comment https://forums.phpfreaks.com/topic/82611-solved-copying-directories/ Share on other sites More sharing options...
trq Posted December 21, 2007 Share Posted December 21, 2007 Use rename, copy only works on files. Quote Link to comment https://forums.phpfreaks.com/topic/82611-solved-copying-directories/#findComment-420094 Share on other sites More sharing options...
loganbest Posted December 21, 2007 Author Share Posted December 21, 2007 cool thanks. Quote Link to comment https://forums.phpfreaks.com/topic/82611-solved-copying-directories/#findComment-420097 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.