#!/bin/sh
#
# This script is used by fas.php for generating a new list file
# if the "use alternative drive" checkbox is checked.
#

if [ -f $1/$2 ]; then
    echo "<b>Error</b>: file $2 already exists, skipping.<br>Content of old list file below.<br><br>"

else 

# Edit the line below to reflect the name of the drive you're using

	echo "Using CD writer for listing.<br>"
	cd $1

# In the line below, replace "/writer" by the directory you'd like to
# use for listing.

	LANG=C ls -lR /writer >$2


	if [ -f $1/$2 ]; then
	    echo "List file successfully created."
	else
	    echo "<br><b>Error</b> - list file could not be created.<br>Make sure the directory <i>$1</i> exists and can be written by this script."
	fi

fi