# Create a new blank movielist rm ${videopath}/${parent_dir}/index.html # Get rid of the old one. touch ${videopath}/${parent_dir}/index.html #>> $logfile #First, create it. # echo "" > ${videopath}/${parent_dir}/index.html #>> $logfile #Empty it. We want a fresh start. # Now to remove movies that have been deleted from the userspace for k in ${videopath}/*/*.flv; do test=`dirname $k` test=`basename $test` parent_dir=${test: 0:$(expr length $test)} # $parent_dir contains the username base=`basename ${k%.*}` # Now to dynamically generate the movie list page # echo "Base=$base" echo "$base" >> ${videopath}/${parent_dir}/index.html echo "
" >> ${videopath}/${parent_dir}/index.html # Check for existing matching files in the upload directory cd "$userpath" && if [[ ! $(find "$parent_dir"* -name "${base%.*}.*" -print) ]]; then # echo "Should remove $k (FLV + HTML)" rm "$k" rm "${k%.*}.html" fi done