0

Simple question here but I'm guessing there's not such a simple answer.

I'm moving m3u playlists from my PC to my smart phone therefore I mass change the directories to suit (see below) as the files structures on both devices are identical.

PC: A:\DANIEL\My Music\Artists A - J\A\Avicii\Avicii - The Nights (Lyric Video).mp3

Phone: ..\My Music\Artists A - J\A\Avicii\Avicii - The Nights (Lyric Video).mp3

My new method means that all of the files will be in the main music directory on my smart phone rather than using the file structure of my PC. Therefore my playlists now need to look like this:

PC: A:\DANIEL\My Music\Artists A - J\A\Avicii\Avicii - The Nights (Lyric Video).mp3

Phone: ..\My Music\Avicii - The Nights (Lyric Video).mp3

Adding the "..\My Music\" directory at the start is obviously easy, but how do I remove the directories, leaving only the file names when there are obviously varying lengths of directories. This one has 3 folders below the "Music" folder however some could be 4, 5 etc.

I could do this manually however when I have many playlists with 300+ songs on each I'm not liking that idea. Can anyone think of a way of doing it on mass?

I've toyed around with pasting the text into Excel's and using it's "Text to Columns" feature but I can't think of way of using this where I wouldn't have to visit each line the same as raw text editing.

Thanks in advance, Dan

  • you can possibly do something using VBScript, or any programming language (would be only some lines of code in C/C++, do you have a compiler?) – Ale Jan 10 '15 at 12:18
0

On excel, write everything on one column, then on the second column, paste this formula to get what you need:

=CONCATENATE("..\My Music\",TRIM(RIGHT(SUBSTITUTE(A1,"\",REPT(" ",LEN(A1))),LEN(A1))))
0

I have searched and asked about this question with no good results, until I somehow reached this Superuser dot com link. Wonderful. If you're not proficient with Excel, even the above might appear daunting, or won't work for you right out of the box.

Here are my examples of before and after, and the slightly modified excel code I used.

My desktop media center software created an .m3u playlist. The contents of the playlist is a simple ansi text editable dataset. Note, that it includes all the desktop PC drives and sub-folders. Some of the software players I tested for my mobile devices could not handle that below file structure. That's the point of the above Excel code.

J:\NTFS_1\MP3_D\Dan Fogelberg - River of Souls - 08 - A Love Like This.mp3

J:\NTFS_1\MP3_H\Harry Chapin - Verities & Balderdash - 04 - 30,000 Pounds Of Bananas.mp3

J:\NTFS_1\MP3_H\Harry Chapin - Story of a Life, disc 2 - 04 - 30,000 Pounds of Bananas (live).mp3

Here below, is the output of my slightly modified version of the above Excel code:

\Dan Fogelberg - River of Souls - 08 - A Love Like This.mp3

\Harry Chapin - Verities & Balderdash - 04 - 30,000 Pounds Of Bananas.mp3

\Harry Chapin - Story of a Life, disc 2 - 04 - 30,000 Pounds of Bananas (live).mp3

In the case above, for my needs, even the default \Music\ folder was removed. Now, with the file structure all 4 mobile software players I have tested work.

For my case, the Excel code looks like:

original code:

=CONCATENATE("..\My Music\",TRIM(RIGHT(SUBSTITUTE(A1,"\",REPT(" ",LEN(A1))),LEN(A1))))

my code version:

=CONCATENATE("\",TRIM(RIGHT(SUBSTITUTE(A3,"\",REPT(" ",LEN(A3))),LEN(A3))))

Of course, on the back end, you still need to copy the second Excel column and paste it into a plain text editor, to save your results. Then, you need to rename the text file from .txt to .m3u.

Hope it works out for you.

  • Welcome to SuperUser! While your post seems pertinent to the question, not sure that it really adds to the already accepted answer which was posted almost 4 years ago. You will find that you will have a better experience if you take moment to take the Stack Overflow tour and I recommend reviewing the site guidelines on How to Ask and How to Answer. If you follow the norms of the Stack Overflow community and approach it with an attitude of helping others too, it will serve you well. – Rey Juna Nov 29 '18 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.