#! /tools/bin/perl

use File::Find; 

my $log_dir="/usr/www/push/php/scripts/logs";
open (F,">$log_dir/dirlist");
open (G,">$log_dir/dirlist_images");
open (H,">$log_dir/dirlist_e2demo");
open (J,">$log_dir/dirlist_static");
find(\&makedirlist, "/usr/www/push/temp/www");
find(\&makedirlist, "/usr/www/push/temp/images");
close (F);
close (G);
close (H);
close (J);

sub makedirlist
{
my $fullpath = "$File::Find::name";
if (( -d "$_" ) and ( $_ ne "CVS")) {
	$fullpath =~ /\/usr\/www\/push\/temp\/(.*)/;
	$stuff=$1;
	if ($stuff =~ m/^images\// || $stuff =~ m/^images$/) {
		print G "$stuff\n";
	} else {
		print H "$stuff\n";
		if ($fullpath =~ m/sandbox/) {
			print "Ignoring this dir because it is in sandbox: $stuff\n";
		} else {
			if (($fullpath =~ m/ad_creative/) || ($fullpath =~ m/static/)) {
				print J "$stuff\n";
			} else {
				print F "$stuff\n";
			} # End of if
		} # End of if
	} # End of if
} # End of if
} # End of makedirlist
