S
Steve P
Hello. I have this script below, and I need to only return the file
names rather than the whole path and filename and I'm a little fuzzy
on how to accomplish this. I've used find2perl to generate part of the
code. I need to read the directory, which is a sym link to a samba
mounted share, and get only the file names, which can and do vary as
well as the directory structure.
__________________________________________________________________________
#! /usr/bin/perl -w
use diagnostics;
use strict;
use File::Find ();
use Cwd;
open(OUT, ">/opt/lampp/htdocs/rfu/rfu.htm") or die "Can't open file:
$!\n";
&print_html();
&processfiles;
&printtail();
&redirect();
sub print_html {
my $curr = cwd ();
print OUT "<HTML>\n<HEAD>\n";
print OUT "<TITLE>File Listing</TITLE>\n";
print OUT "</HEAD>\n<BODY>\n";
print OUT "<P>\n";
}
sub processfiles {
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find:
rune;
File::Find::find( {wanted => \&wanted, follow => 1},
'/opt/lampp/htdocs/rfu/');
sub wanted {
/^.*\.rfu\z/s &&
print OUT ("$name\n<BR>");
}
}
sub printtail {
print OUT "</BODY></HTML>\n";
close OUT;
}
sub redirect {
print 'Location: http://www.someplace.com/rfu/rfu.htm',
"$ENV{QUERY_STRING}\n\n";
}
_________________________________________________________________
Thanks in advance
Steve Powell
names rather than the whole path and filename and I'm a little fuzzy
on how to accomplish this. I've used find2perl to generate part of the
code. I need to read the directory, which is a sym link to a samba
mounted share, and get only the file names, which can and do vary as
well as the directory structure.
__________________________________________________________________________
#! /usr/bin/perl -w
use diagnostics;
use strict;
use File::Find ();
use Cwd;
open(OUT, ">/opt/lampp/htdocs/rfu/rfu.htm") or die "Can't open file:
$!\n";
&print_html();
&processfiles;
&printtail();
&redirect();
sub print_html {
my $curr = cwd ();
print OUT "<HTML>\n<HEAD>\n";
print OUT "<TITLE>File Listing</TITLE>\n";
print OUT "</HEAD>\n<BODY>\n";
print OUT "<P>\n";
}
sub processfiles {
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find:
File::Find::find( {wanted => \&wanted, follow => 1},
'/opt/lampp/htdocs/rfu/');
sub wanted {
/^.*\.rfu\z/s &&
print OUT ("$name\n<BR>");
}
}
sub printtail {
print OUT "</BODY></HTML>\n";
close OUT;
}
sub redirect {
print 'Location: http://www.someplace.com/rfu/rfu.htm',
"$ENV{QUERY_STRING}\n\n";
}
_________________________________________________________________
Thanks in advance
Steve Powell