#! /tools/bin/perl

require '/usr/www/push/php/scripts/auth.pl';

#my $release=shift;
my $release="www_temp";
my $release_dir="/o/prod/current/"."www_"$release."/";
my $source_dir="/usr/www/push/qa_branch/";
my $image_dir_list="/usr/www/push/php/scripts/logs/dirlist";
my $machine="fed1";
my $ssh="/tools/bin/ssh";
##################################################

&make_dir;
&auth;

my $scp="/bin/scp -C";

if (! defined $release) {
	print "Please define the release!!! (2_4_3) \n";
	exit 1;
} # End of if


my $cmd="$ssh bd\@$machine \"mkdir $release_dir\"  ";
print "$cmd\n";
system($cmd);

open(FILE,$image_dir_list);
my @dirs=<FILE>;
chomp(@dirs);
close(FILE);

foreach $dir (@dirs) {
	my $source=$source_dir.$dir;
	my $dest_dir=$release_dir.$dir;
	my $cmd="$ssh bd\@$machine \"mkdir -p $dest_dir\"  ";
	print "$cmd\n";
	system($cmd);
	$cmd="cd $source; $scp * bd\@$machine:$dest_dir ";
	print "$cmd\n";
	system($cmd);
} # End of foreach

