#!/usr/bin/perl

use List::Util 'shuffle';

my $dir = "/naspool/videos/HomeVideos";
my $plsfile = "$dir/Random.pls";
my $mkvfiles = "????/*.mkv";

chdir $dir || die "Couldn't change directory!\n";
system "rm -f $plsfile";
@files = `ls -1 $mkvfiles`;
@shuffled = shuffle(@files);
open (FILE, ">$plsfile") || die "Couldn't open $plsfile!\n";
print FILE @shuffled;
close (FILE);

