OAFC_Rob Posted March 1, 2015 Share Posted March 1, 2015 I have a folder in the following public structure; /public/assets/songs/test/mp3/test.mp3 and I simply want to rename it to; /public/assets/songs/test1/mp3/test1/mp3 So simply just change the main directory and the mp3 filename, simple enough or so I thought. I've tried loads of different combination and still can't seem to get both to rename. Here is the simplest form of my code; rename('./assets/songs/test', './assets/songs/test1'); rename('./assets/songs/test1/mp3/test.mp3', './assets/songs/test1/mp3/test1.mp3'); Any ideas? I have even tried to rename the directory with mv via exec but still nothing, this is really frustrating. $cmd = 'mv ./assets/songs/test ./assets/songs/test1'; exec($cmd, $output, $return_val); Quote Link to comment https://forums.phpfreaks.com/topic/294978-renaming-directory-and-file-within-directory/ Share on other sites More sharing options...
Solution OAFC_Rob Posted March 1, 2015 Author Solution Share Posted March 1, 2015 Scrap that, it does work. It's the Mac file finder that's not updating the directory was changing but the file didn't seem to be but going via command line proved that the two lines of code were in fact working. Jesus, just lost enough time to this issue because of switching over to a mac grrr!! Quote Link to comment https://forums.phpfreaks.com/topic/294978-renaming-directory-and-file-within-directory/#findComment-1507127 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.