1 |
#!/usr/local/bin/perl |
2 |
|
3 |
use DBI; |
4 |
my $dbh = DBI->connect("DBI:Pg:dbname=corp","","") || die $DBI::errstr; |
5 |
my $sth; |
6 |
|
7 |
#my $dir="/home/dpavlin/private/corp/public_html/vet"; |
8 |
my $dir="/data/corp_html/vet"; |
9 |
opendir(DIR, $dir) || die "can't opendir $dir: $!"; |
10 |
#grep { /^\./ && -f "$dir/$_" && /^\d\d\d\d.htm/ } |
11 |
while($file=readdir(DIR)) { |
12 |
if ($file !~ /^\./ && -f "$dir/$file" && $file =~ /^\d\d\d\d\.htm/) { |
13 |
$file=~s/\.html*//; |
14 |
push @smpcs,$file |
15 |
} |
16 |
} |
17 |
closedir(DIR); |
18 |
|
19 |
$dbh->do("update vet_products set have_smpc=false"); |
20 |
$dbh->do("update vet_products set have_smpc=true where smpc in (".join(",",@smpcs).")"); |