use Net::SMTP;
use HTTP::Date qw(time2iso str2time time2iso time2isoz);
my $CurrTime = time2iso(time());
my $dis_mainpublish='中均资本';
my $menu= <<EOF;
DATE:$CurrTime
--------------------------------------------------
$dis_mainpublish
--------------------------------------------------
****** 1) "清空发布目录" *******
****** 2) "获得SQL更新目录" *******
****** 3) "更新后同步SVN" *******
****** 4) "退出系统" *******
EOF
undef @arr1;
undef @arr2;
my $red="e[1;31m";
my $green="e[1;32m";
my $yellow="e[1;33m";
my $normal="e[0m";
print $menu;
print "please choose [1-2-3-4]:
";
chomp (my $val=<STDIN>);
use Switch;
switch ($val) {
case 1 {
print "hints->$red请在svn更新后,在执行2操作$normal
";
if ( -e "C:\update") {system("rd /s/q C:\update") };
unless ( -e "C:\update"){system("mkdir C:\update") }
}
case 2
{
#$dirname = "C:\a1";
$dirname="E:\svn chkout\Database2.0\update_sql\";
opendir ( DIR, $dirname ) || die "Error in opening dir $dirname
";
while( ($filename = readdir(DIR))){
push @arr1,$filename."
";
}
closedir(DIR);
sort @arr1;
print @arr1;
########################################################################
$dirname = "C:\update_sql";
opendir ( DIR, $dirname ) || die "Error in opening dir $dirname
";
while( ($filename = readdir(DIR))){
push @arr2,$filename."
";
}
closedir(DIR);
sort @arr2;
print @arr2;
@arr2 = grep {$count{$_} == 1 } grep {++$count{$_}} (@arr1, @arr2);
print "--------增量信息------------
";
print "@arr2
";
use File::Copy::Recursive qw(dircopy);
foreach (@arr2) {
print "$_ is $_
";
chop $_;
my $source_dir="E:\svn chkout\Database2.0\update_sql\$_";
my $target_dir="C:\update\$_";
my $copy_ret=dircopy($source_dir,$target_dir) or die $!;
}
}
case 3 {system("C:\rsync.bat"); }
else { exit; }
}