#!/usr/local/bin/perl ############################################################################################# #Create a directory list and write it to a file # # change $dircommand to whatever command works on your server. This work well on UNIX # change domain to your domain, and directory to and directory you choose. # # When run, # This script will output to a file called "dirlist.dat", but you have to create it first! # ############################################################################################# print "Content-type: text/plain\n\n"; open(OUTF,">/home/domain/htsdata/dirlist.dat") or &dienice("Can't open dirlist file for write."); $dircommand = 'ls -l -Q /home/domain/htsdata/directory/'; @ary = `$dircommand`; foreach $line (@ary) { chomp($line); print OUTF "$line\n"; # print "$line\n"; } close(OUTF); sub dienice { $errmsg = @_; print "
\n"; print "