All pastes #187566 Raw Edit

Someone

public text v1 · immutable
·published 2006-10-01 07:13 UTC
rendered paste body
#!/usr/bin/perl -w
use File::stat;

$basepath="/";

sub getfilelist($);

sub getfilelist($){
	local $path = shift;
	print "=scanning $path\n";
	opendir(DIR, "$path");
	local @files = readdir(DIR);
	closedir(DIR);

	splice (@files, 0, 2); #remove '.' '..' from files

	local $file;	
	foreach $file (@files) {
#		print "$file\n";
		if ( -d $file){
		#//else if $file is dir
		#	// recurse 
			print "=decending into $file\n";
			local $b="$path/$file";
			getfilelist($b);
		}
		elsif ( -x $file){ # is exe
		#	// do ldd
		#	// record results
			print "$file is executable\n";
		}
	}
	print "=acending\n";
}

getfilelist($basepath);