3

I want to create a .m3u (playlist) file for every folder that's inside a directory, automatically and save it inside that particular folder with the name of that particular folder?

How to Create an .m3u file with command?

 playlist='play.m3u' ; if [ -f $playlist ]; then rm $playlist ; fi ; for f in *.mp3|; do echo "$(pwd)/$f" >> "$playlist"; done

This command does it for ".mp3" files, for a single directory

Source

Multiple File formats

I want the above command to work on any Audio/Video formats. extensions like .m4a .flac .mp4 .mkbv so that it can be used for Video playlists as well

Multiple Directories

Multiple directories

if I apply the script on the parent folder of these folders, each one of these folders should get their own .m3u file

Nautilus Script

if possible a Nautilus Script that could do all this with a right click would be amazing, i'm ready to give more outputs or anything else required

Advantages

  1. Good File Management
  2. it'll automatically add the playlist with the name of the album in Rythmbox (or other music players)
  3. Once it's done their is no need to play files from going folder to folder

2 Answers 2

1
find -type f -iname "*.mp3" -or -iname "*.flac" -or -iname "*.m4a" > playlist.m3u

Another idea is you could use a bash loop and check for the mime type using the file command:

echo "" > playlist.m3u

for path in $(find -type f) do;
   if [ file --mime-type "$path" | egrep '(audio|video)' ]; then
      echo "$path" >> playlist.m3u
   fi
done
-1

Doing a research in this field, I found this Bash script to create .m3u playlist files for all mp3s in subdirectories created by scarlson.

This meets your most essential requirements: multiple file formats and multiple directories.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .