#!/usr/bin/perl -w -T use strict; use Data::Dumper; my $urlbase='http://proxy/cgi-bin/getobj.pl?'; my $path = shift @ARGV or die; sub recurse { my $dir = shift; if ( '/' ne substr($dir,-1,1) ) { $dir = $dir.'/' }; my $base = substr($dir , length($path)); my %tree; opendir(DR , $dir); my @stuff=(readdir DR); closedir(DR); LOOP: foreach my $path ( @stuff ) { my $dot = substr ($path,1,1); next LOOP if ( $dot eq "" || $dot eq "." ); if (-f "$dir$path") { # Associate a file with a url $tree{$path}="$urlbase$base$path"; } if (-d "$dir$path" && ! -l "$dir$path") { # Decend into directory (ere's the recursion. my %glob = recurse( "$dir$path" ); $tree{$path}=\%glob; } } return %tree; } print Dumper recurse ( $path ) ; exit;