Rename problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
comedydave
Forum Newbie
Posts: 16
Joined: Thu Mar 09, 2006 8:51 am

Rename problem

Post by comedydave »

Hi guys, i have a variable that holds a file path such as

Code: Select all

media\50 Cent ft Snoop Dogg\Shady Records-(Promo)\04 P.I.M.P. Remix.mp3
And i have code that will check the filename, and strip out ! ' - from the filename and rename it, the trouble being that if it finds it before the actual mp3, like in a prent folder it will rename it and try to rename the folders too (which is also what i want) but then tries to write the whole path back to the server

For example

Code: Select all

media\50 Cent ft Snoop Dogg\Shady Records-(Promo)\04 P.I.M.P. Remix.mp3
would be renamed to:

Code: Select all

media\50 Cent ft Snoop Dogg\Shady Records(Promo)\04 P.I.M.P. Remix.mp3
which throws up an error as it says that the folder "50 Cent ft Snoop Dogg" exists

which is what i want but, all i need renaming is

Code: Select all

Shady Records-(Promo)\04 P.I.M.P. Remix.mp3
as this is all thats changed.

I think i need some sort of code that will check each folder in the path seperately until it reaches the mp3 and rename it accordingly

Any ideas, not sure if i've made it very clear

Thanks alot,

Dave
Post Reply