Exoon Posted March 7, 2009 Share Posted March 7, 2009 Hello, Im trying to rename a directory when a user types in a new game name but keep getting an error saying directory dosent exist but it does. <?php $olddir = "/home/gamer/domains/247gamer/public_html/images/game/$game_console/$game_name2"; $newdir = "/home/gamer/domains/247gamer/public_html/images/game/$game_console/$updated_game_name1"; rename("$olddir", "$newdir") Im getting the following error: Warning: rename(/home/gamer/domains/247gamer/public_html/images/game/ps3/Oliver223,/home/gamer/domains/247gamer/public_html/images/game/ps3/Oliver2234) [function.rename]: No such file or directory in /home/gamer/domains/247gamer/public_html/admin/edit_game.php on line 82 I have chmodded images, game, every console and every game name to test it but still says the directory dosent exist. Am i not using it right or somthing, i made a test putting an image in the same directory as the script and that worked fine. Hope some1 can help. thanks Link to comment https://forums.phpfreaks.com/topic/148343-solved-rename-path-problem/ Share on other sites More sharing options...
Mikedean Posted March 7, 2009 Share Posted March 7, 2009 I'm not sure if this will work, but maybe try: $olddir = "../images/game/$game_console/$game_name2"; $newdir = "../images/game/$game_console/$updated_game_name1"; if( is_dir( $olddir ) ) rename("$olddir", "$newdir"); else echo "Folder doesn't exist."; Link to comment https://forums.phpfreaks.com/topic/148343-solved-rename-path-problem/#findComment-778801 Share on other sites More sharing options...
Exoon Posted March 7, 2009 Author Share Posted March 7, 2009 It just says Folder doesn't exist. But the folder does exist. Link to comment https://forums.phpfreaks.com/topic/148343-solved-rename-path-problem/#findComment-778803 Share on other sites More sharing options...
PFMaBiSmAd Posted March 7, 2009 Share Posted March 7, 2009 Is Oliver223 a file or a folder and is it actually Oliver223 or oliver223? If it's a folder, you need a trailing slash / and if you are on a case-sensitive operating system, the letter-case must match exactly. Link to comment https://forums.phpfreaks.com/topic/148343-solved-rename-path-problem/#findComment-778804 Share on other sites More sharing options...
Exoon Posted March 7, 2009 Author Share Posted March 7, 2009 Hello, I added a trailing slash and it worked! thanks for the help! Link to comment https://forums.phpfreaks.com/topic/148343-solved-rename-path-problem/#findComment-778808 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.