Reply
SanDisk Professor
Posts: 568
Registered: ‎09-12-2015

Simple Batch File for Playlist of All Files on Micro SD Card

[ Edited ]

I have been testing a simple batch file command to create a single playlist for all music files within the Music folder on my micro SD card.  This method works when the batch file is saved into the Music folder.   The player shuffle command can be set to On or Off to shuffle files while playing the playlist.

      If the batch file is saved within a subfolder within the Music folder, the command will create a playlist of all music files within the subfolder collection.

     The m3u file produced by this batch command is named Playlist.m3u   The m3u file should be renamed as needed.

            (cannot have multiple m3u files with same name)

 

Here is the text of the playlist command for the batch file:

@echo off
dir /o:n /s /b *.mp3 *.wma *.wav> Playlist.m3u

 

Create the batch file by copying these 2 lines into a text file and save as a text file named "myplaylist.bat"

I execute the batch command by double-clicking on the batch file using Win File Explorer.    .

(This method works on a PC, not on a Mac).

 

Please leave comments, suggestions, problems, better ideas ???

 

Newbie
Posts: 5
Registered: ‎06-24-2017

Re: Simple Batch File for Playlist of All Files on Micro SD Card

How do u do this from a Android phone?
Highlighted
SanDisk Guru
Posts: 16,265
Registered: ‎04-17-2008

Re: Simple Batch File for Playlist of All Files on Micro SD Card


@Needhelpinhere wrote:
How do u do this from a Android phone?

You can't. You must do it on a computer.

SanDisk Professor
Posts: 568
Registered: ‎09-12-2015

Re: Use Android Device to Manage Files on Clip Sport ??

[ Edited ]

I do not have any Android phones or tablets. But I do like using The Google. 

I found these two possibly useful links:  Seem to require an on-the-go USB cable.

 

https://www.howtogeek.com/129800/how-to-use-usb-drives-with-the-nexus-7-and-other-android-devices/

 

https://www.howtogeek.com/202644/how-to-manage-files-and-use-the-file-system-on-android/

Newbie
Posts: 1
Registered: ‎01-06-2018

Re: Simple Batch File for Playlist of All Files on Micro SD Card

I've added some extra code to the batch file so it prompts you to enter a playlist name.

 

@echo off
set /p id=Playlist Name:
dir /o:n /s /b *.mp3 *.wma *.wav> %id%.m3u

 

Hope this is useful to someone :-) 

SanDisk Professor
Posts: 568
Registered: ‎09-12-2015

Re: Simple Batch File for Playlist of All Files on Micro SD Card

Fantastic !!  

Thank You !!

SanDisk Professor
Posts: 568
Registered: ‎09-12-2015

Re: Simple Batch File for Playlist of All Files on Micro SD Card

And recently I figured out how to use my Mac Mini to execute the batch file command in a Clip Sport music folder using Wine.

        https://www.howtogeek.com/263211/how-to-run-windows-programs-on-a-mac-with-wine/

Newbie
Posts: 1
Registered: ‎08-19-2018

Re: Simple Batch File for Playlist of All Files on Micro SD Card

Genius!

Thank you - now I don't have to throw the player away.  Pretty useless without Playlists you can manage.

Newbie
Posts: 4
Registered: ‎11-17-2018

Re: Simple Batch File for Playlist of All Files on Micro SD Card

[ Edited ]

Is there a way to create a single playlist which enables you to play files from the internal storage and external without messing about?

 

Also, I can't seem to create a playlist on the internal storage. It says 'File not found' after I input a playlist name. I am using elevated permissions to run the batch file.

Newbie
Posts: 1
Registered: ‎02-23-2019

Re: Simple Batch File for Playlist of All Files on Micro SD Card

Hi, I really like your enhancement and it works great, but most of the time I use Ubuntu and so you guys inspired me to write a script for Linux. It may be work on Apple as well.

 

To get it on your computer, create an empty text file. Copy the code into it. Rename it to: create_playlist_linux.sh

How to use it and what the commands are for is written in the 'code'.  I hope it of use for one or the other.

 

 

#!/bin/bash

# SanDisk player Clip Sport, create a playlist

# run an executable on USB with ubuntu 18.04:
# showexec is the option which says that you cannot execute any file on the mounted device.
# To run "create_playlist_linux.sh" anyway, do this:
# Copy "create_playlist_linux.sh" on/in your SanDisk Music folder.
# Open a terminal and go to your SanDisk Music Folder, start the playlist creation like this:
# sh create_playlist_linux.sh  (hit Enter on your keyboard).

# To create a Podcast-Playlist, you must run it in the Podcast-folder on your SanDisk and copy the playlist to the Music folder.
# ONLY IN THE MUSIC FOLDER YOU CAN START THE PLAYLIST !!!
# The line break must be in Windows format (CRLF) = (\r\n) !

# Print the current directory/Folder
echo ""
echo ""
echo "*** The bash-file is launched in this directory: "
pwd
echo ""

echo "Now reading all files that ends to *.mp3 *.ogg *.wma *.wav ..."
echo ""

# https://stackoverflow.com/questions/10986794/remove-part-of-path-on-unix
# To get full path = "$(pwd)"
# Remove a certain NUMBER of path components = cut -d'/' -f5-
# add Windows line break (\r\n) at the end of each line: sed 's/$/\r/' Unix already has \n.
#
find "$(pwd)" -regex ".*\(\.ogg\|\.mp3\|\.wma\|\.wav\)$" | cut -d'/' -f5- | sed 's/$/\r/' > 000_playlist_$(date +%H%M%S).m3u

# full path file names of the desired files
# find $(pwd) -name \*.mp3 -print > 000_playlist_$(date +%H%M%S).m3u

# Search based on file type
# find . -type f -print > 000_playlist_$(date +%H%M%S).m3u

echo "written the playlist to your SanDisk"
echo ""

# wait for  to start
sleep 1

# open default file manager 
xdg-open .

# wait for  to start
sleep 1

echo "****** finished, automatic exit ******"
echo ""
echo "your file manager should open now to adjust file name"
echo ""
#exit

 

Cheers,

Tido