Want to copy a playlist, try this

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Hoser Rob
Level 20
Level 20
Posts: 11796
Joined: Sat Dec 15, 2012 8:57 am

Want to copy a playlist, try this

Post by Hoser Rob »

Just did this again, very useful for copying music files from my laptop to my netbook. Things like this are what I love about Linux. So I'm posting it again.

I usually use the 2nd command which numbers the playlist items. It's far too easy IMO to hit the wrong thing in media players and mess up the order. Numbering makes it easy to recover.

Export your playlist to a m3u file. I called it playlist.m3u here, don't just blindly copy/paste this stuff. This is why I didn't ember the strings in <code> tags.

Open a terminal in the folder where you have saved the file.

Copy & paste this:

sed "s/#.*//g" < playlist.m3u | sed "/^$/d" | while read line; do cp "${line}" '/path/to/output/folder/'; done

Modified so that files are renamed according to their position in the playlist:

sed "s/#.*//g" < playlist.m3u | sed "/^$/d" | while read line; do (( COUNTER++ )); filename="${line##*/}"; cp "${line}" "/path/to/output/folder/$COUNTER - $filename"; done
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
For every complex problem there is an answer that is clear, simple, and wrong - H. L. Mencken
Locked

Return to “Sound”