#!/usr/bin/perl

use List::Util 'shuffle';

my $dir = "/naspool/videos/HomeVideos";
my $plsfile = "$dir/Random.pls";
my $avifiles = "????/????-??-??.avi";

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

