In VLC media player, I can use vlc -LZ <file 1> <file 2> <file 3> for example to play various files on repeat and shuffled. Is it possible to specify a whole directory and play all the music within the folder and it's subfolders?

Say I am hosting a party and have a folder with "Party Music", how would I play all the music from that folder in a loop and repeating the whole playlist?

10 Answers 10


By commandline, with recent versions, it should work with your command options and the name of the directory(ies) instead of the files:

vlc --LZ  "Party Music"

If your path includes spaces you need to include it between "".
Only if you modified the default options you may need to add also --playlist-autostart.
The option --playlist-tree only shows the playlist as a tree. Enable if you want.
If you are not in the parent directory of "Party Music" you have to specify the whole path, complinat with your operating system (e.g. "C:\Music\Party Music" or "~/Music/All Music/Party Music" or /media/user/usb/Party Music).

VLC usually remembers the last setting you decided. If you run from commandline (or with a link built for this purpose) it will overcome the usual behaviour following the prescription specified by the options without changing it. If instead you will change some setting during its run it will remember the next time.

From vlc --help

-L, --loop, --no-loop        Repeat all                      (default disabled)
-Z, --random, --no-random    Play files randomly forever     (default disabled)
                             VLC will randomly play files in the playlist 
                             until  interrupted.             (default disabled)
--playlist-autostart, --no-playlist-autostart
                             Auto start                      (default enabled)
--playlist-tree, --no-playlist-tree
                             Display playlist tree           (default disabled)

Tested on VLC media player 2.1.6 Rincewind on Ubuntu, but it should work on precedent versions and for different operating systems too.

  • Am I the only one getting the error: vlc: unknown option or missing mandatory argument `--LZ' I'm using Version: VLC media player Vetinari (revision 3.0.13-8-g41878ff4f2)
    – JUlinder
    Aug 25 at 9:54
  • @JUlinder Note -L -Z is different from --LZ... maybe it solves the problem.
    – Hastur
    Aug 27 at 17:23

According to this blog post the --playlist-tree will play everything in the folder passed into it. For example:

"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --playlist-autostart --loop --playlist-tree c:\playlist\

Also note that the example is for a Windows system, you may need to modify the syntax slightly if you are using a Unix based system.

  • Are there shortened options for --playlist-tree and --playlist-autostart ? And is --loop the same as -L (Repeat) ? Jul 24, 2013 at 20:43
  • I tried what you suggest and with your command, on Windows, vlc tries to open file "C:\playlist\" and cannot, as it's not a file. It's the same on Linux btw.
    – Levans
    Jul 24, 2013 at 20:54
  • It looks like "-L" is short for "--loop" and "--playlist-autostart" and "--playlist-tree" don't have shorter commands. You can see a full list of command line options with "--help". Thats where I found the answer.
    – tbenz9
    Jul 24, 2013 at 20:56
  • Just in case you were still in doubt ;) -L and --loop are the same and are reported on the same help line. By conventions (IEEE and GNU Getopt) when one letter there is one - when longer there are 2 --. By convention... is not a dogma of course, but it's rather common.
    – Hastur
    Oct 2, 2015 at 10:14

As I didn't get tbenz9's solution working, I wrote a little batch script doing the trick:

cd C:\your\directory\with\music
for /r %a in (*) do "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" -LZ --one-instance --playlist-enqueue "%a"

The --one-instance option tells VLC media player to keep only one window, and I think --playlist-enqueue is quite explicit.

On Linux, it can be simply achieved with:

find /my/music/directory/ -type f -exec vlc -LZ '{}' +
  • The trick doesn't work with VLC 3.0.11 for Windows x64. It adds one file and the script continues waiting until I close VLC. Jul 22, 2020 at 23:25
  • A simple example solution in PowerShell based on --one-instance and --playlist-enqueue (with basic wildcard support) can be found here. Jul 30, 2020 at 4:19

I often need to work my way thru a lot of videos, in a particular sequence. When I stop watching one, I want my player to remember where I was, and resume from that point.

VLC cannot do either of these, not without extra work. Instead, I use "Media Player Classic - Home Cinema" http://mpc-hc.org/ for this very reason. I even created my own tiny script to launch MPC-HC and resume the most recently-played file automatically.

The VLC development team is opposed to automatically playing the next file, even as an option. They insist that you must select the files manually, and then add them to a playlist, or open the folder (which would start from the first file, which isn't what I want), or add them individually. Their dogma is NOT user-friendly!


For linux (I have no windows machines handy). All of this is from the man pages and/or --help output. I also TESTED these to work.

find /Music/Directory/ -type f -exec vlc --one-instance --playlist-enqueue --playlist-autostart --fullscreen -Z '{}' +

The "-L" shouldn't be needed because help for "-Z" says "Play files randomly forever"

Or, if you'd prefer to use mplayer (vlc video scaling is currently borked on one of my machines)

find /Music/Directory/ -type f -exec mplayer -enqueue -shuffle -fs -loop 0 '{}' +
  • I tried the mplayer command on Rhaspbian but mplayer complained that -enqueue was not a valid option. Seems to work when that is removed though. Sep 30, 2019 at 18:39

Just figured out the easy way, you open vlc then choose media. Then open map and you choose the map with all the music. Done!


Here is a great solution if you're on Mac OS X. This will start a full screen, loop playback of all media inside a folder:

Example command:

find /Users/NRK/Movies -type f -exec /Applications/VLC.app/Contents/MacOS/VLC -LZf --video-on-top --no-video-wallpaper --no-osd '{}' +

To make it work for you, do these steps:

  1. Path to media folder. Replace NRK with your username to point to your Movies folder


  1. Open VLC, go to Preferences -> Interface -> Use the native fullscren mode

  2. (Optional step) remove "--no-osd " from the command to still show the name of each file that gets played.


Below command Plays all the music in the sorted order

   vlc -Z --no-random chakri/Desktop/Folder_Name 

Plays random music

vlc -Z --random chakri/Desktop/Folder_Name

add a shortcut with the above commands to play it anytime!


I had vlc installed on Ubuntu. All you need to do is give the folder name. e.g.

/usr/bin/vlc /home/adeel/Music

FYI:Caution Please do remember that vlc can't play midi files. So if there is a folder containing midi files. Better move that folder to some other place; maybe in Documents etc.


Easiest Way: right click on folder, click on "Play with VLC media player" then VLC will open, click on "Media" option in VLC then click on "Save Playlist to file" then save it on desktop or appropriate location and whenever you open that file, your folder will start playing

You must log in to answer this question.

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