#!/usr/local/bin/perl ### Helper application to the "album" system by Anders Hultman, september 2001 ### NB this is not a CGI program, it should be run from the Unix command line ### Prints a help text when invoked with the -h flag use Getopt::Std; getopt('abdD'); ### Change basedir to where you keep your images (this is a file system path). $basedir = "/home/web/bilder/"; if ($opt_h) { print "Prints the filenames of a directory. Each one on a line and with a trailing space.\n"; print " -b String to put before each filename.\n"; print " -a String to put after each filename.\n"; print " -s Short name without extension.\n"; print " -S No trailing space.\n"; print " -d Specify directory.\n"; print " -D Specify directory relative to $basedir (overrides -d).\n"; print " -h This help text.\n"; exit(0); } if ($opt_d) { chdir ($opt_d); } if ($opt_D) { chdir ($basedir.$opt_D); } foreach (<*>) { print $opt_b; if ($opt_s) { $_ = substr($_,0,rindex($_,".")); } print $_; print $opt_a; print " " unless ($opt_S); print "\n"; }