Jump to content
Sign in to follow this  

Renaming directory and file within directory

Recommended Posts

I have a folder in the following public structure;




and I simply want to rename it to; 




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); 

Share this post

Link to post
Share on other sites

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!! 

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.