Page 1 of 1

Rename problem

Posted: Fri Mar 10, 2006 7:40 am
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