Go Back   abi>>forums > MP3 Players By Brand > SanDisk Sansa > Sansa Clip / Clip+ / Clip Zip

Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 04-25-2010, 04:35 AM
soyandrice soyandrice is offline
Junior Member
Join Date: Nov 2008
Posts: 18
Default Anyone using Linux? Looking for a shell script that'll modify .m3u

UPDATE: Okay, I can confirm that the script for exaile works. However, I would still like someone to confirm if it actually runs and works for other music players ^^

The Idea:
Note: I use Exaile so it can export playlists as .m3u. Problem is, it uses absolute paths, not relative paths. Depending on how the player outputs the .m3u, the second line starting with sed will be different.

You'll need the tofrodos package.
sudo apt-get install tofrodos



sed -i 's#'"${HOME}"'/##g; s#''%20''#'' ''#g; s#''/''#''\\''#g' *.m3u 
unix2dos *.m3u

For Exaile (The Script I Use):

sed -i 's#file://'"${HOME}"'/##g; s#''%20''#'' ''#g; s#''/''#''\\''#g' *.m3u 
unix2dos *.m3u

For Amarok:


sed -i 's#./Music#Music#g; s#''%20''#'' ''#g; s#''/''#''\\''#g' *.m3u
unix2dos *.m3u
If there's another player (e.g. banshee, rhythmbox) that you want a script for, just post the output and I can try to make one for that player.

How it Works:
This will remove the "/home/USER/" (and whatever is in front, depending on the script) and replace "/" with "\" in front of all the paths in any file with the extension .m3u. This assumes that the .m3u files are in the same directory as this script is located.
The last line should convert the unix line terminations to dos.

Depending on the output, copy and paste the code into your favourite, text editor, save it as (or whatever you want to name) into your Home folder.

Make it executable by going through the File Manager, right-clicking it, selecting Properties, going to Permissions, and checking 'Allow executing file as program' (I use Ubuntu so it may be different for other distros).


Open a terminal, type
chmod +x
and press enter.

Move into the root directory of your MicroSD. Be sure to export your playlists onto the root directory of you Sansa Clip+ - that way, your playlists and script is in the same folder.

After that, run and the playlists should show and work on the Sansa Clip+.

Last edited by soyandrice; 05-03-2010 at 06:28 PM.
Reply With Quote

Advertisement [Remove Advertisement]


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 09:32 AM.