I would love to hear any other ways of doing this.My perl script cannot reside on the server since its used for multiple projects but the reqmnt is that i need to access move and copy certain files in a dump folder.
Thanks+--------+-------------+---------+------+------+ |Sys_Acc | Report_name |Job_name | Dump |Print | +--------+-------------+---------+------+------+ |SYSX | abc | 123a | yes | no | +--------+-------------+---------+------+------+ |SYSY | ade | 783a | no | yes | +--------+-------------+---------+------+------+
#!usr/bin/perl -w use DBI; use File::Copy; @files=<H:/what_to_do/*>; print "+---------------------------------------------+\n"; print "| Here are the list of files in the directory |\n"; print "+---------------------------------------------+\n\n"; foreach my $file (@files){ my @arr=split(/\//,$file); print "\n"; my @field=split(/%/,$arr[2]); print $arr[2]."\n\n................................................... +.......\n"; my @arr1=split(/\./,$field[3]); pop(@arr1); my $sec=pop(@arr1); my $min=pop(@arr1); my $hr=pop(@arr1); my $date_string=join('-',@arr1); my $sysacc=$field[0]; my $rid=$field[2]; my $jid=$field[1]; my $time=$hr.":".$min.":".$sec; #print "System:\t\t $sysacc \nreport id:\t$rid \njob id:\t\t$jid\ndate + stamp:\t$date_string\ntime :\t\t$hr:$min:$sec \n"; #print "============================================================== +=\n"; my $oldloc=$file; $dbh = DBI->connect('dbi:ODBC:driver=microsoft access driver (*.mdb);d +bq=C:\Documents and Settings\smanicka\Desktop\public_html\lookup_test +.mdb') or die "Sorry,Cant connect\n $DBI::errstr \n"; my $query= "select * from lookup where Sys_Acc=\'$sysacc\' AND Job_nam +e=\'$jid\' AND Report_name=\'$rid\'"; my $sth=$dbh->prepare($query); $sth->execute(); my $status=0; my @stash; while($arr_ref=$sth->fetchrow_array()){ #$status=1; push @stash,[@$array_ref]; } foreach $array_ref(@stash){ print "ROw: @$array_ref \n"; } #if($status==0){ #print " not found"; #} #else{ #print "found";} ## where Sys_Acc=\'$sysacc\'& Job_name=\'$jid\' & Report_name=\'$rid\' #$newloc="h:/newtest/$sysacc/$arr[2]"; #move($oldloc,$newloc)or die "fail to move"; }
In reply to need to access a remote server to move the files around in a set folder there by smanicka
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |