dakarr
asked on
Convert Perl to Visual Basic
I have a Perl Script and I don't write Perl. I know the script is moving files to folders based on the names of the files. Rather than learn Perl and convert it, I'll post it. Please help me decipher it and give the appropriate VB Commands for the various sections. I'm not asking for a total conversion (but it would be nice!):
#File_Move.pl Moves or copies a file from one folder to another.
#
$currtime = time();
$timelist = localtime ($currtime);
$execute_time = $timelist;
$execute_time =~ s/^.{11}//g;
$execute_time =~ s/.{5}$//g;
$timelist =~ s/[0-9][0-9]:[0-9][0-9]:[0 -9][0-9]// ;
$Log_out_file = $timelist;
$Log_out_file =~ s/ /_/g;
$Log_out_file =~ s/__2000/_2000/;
$Destination = "";
#Execute Command input queue sends filename with the path.
$In_File = $ARGV[0];
$Out_File = $In_File;
#Strip the path off of the filename
$Out_File =~ s/[a-z,A-Z]:\\//g;
$Out_File =~ s/\w+\\//g;
#Figure out which folder the file came in.
if ($In_File =~ /^d:\\icl_pages\\/i) {
goto ICL;
} elsif ($In_File =~ /^d:\\ClassPS\\/i) {
goto ICL;
} elsif ($In_File =~ /^e:\\Send_to_OMan\\/i) {
goto STO;
} elsif ($In_File =~ /^e:\\OPI_Incoming_Art\\/i ) {
goto OPI;
} elsif ($In_File =~ /^d:\\DTI_Pages\\/i) {
goto DTI;
} elsif ($In_File =~ /^d:\\DTI_11\\/i) {
$Destination = "d:\\Drop\\DTI_11-5\\$Out_ File";
goto Move_File;
} elsif ($In_File =~ /^d:\\DTI_12\\/i) {
$Destination = "d:\\Drop\\DTI_12-5\\$Out_ File";
goto Move_File;
}
DTI:
if ($Out_File =~ /^cp/i) {
$Destination = "d:\\Drop\\DTIClassPrf\\$O ut_File";
goto Move_File;
} elsif ($Out_File =~ /^cx/i) {
$Destination = "d:\\Drop\\Dti_12-5\\$Out_ File";
goto Move_File;
} goto BADFILENAME;
ICL:
if ($Out_File =~ /^ap/i) {
goto NewsProof;
} elsif ($Out_File =~ /^ax/i) {
$Destination = "d:\\Drop\\AdvNeg\\$Out_Fi le";
goto Move_File;
} elsif ($Out_File =~ /^cc/i) {
$Destination = "d:\\Drop\\ClsTest\\$Out_F ile";
goto Move_File;
} elsif ($Out_File =~ /^cp/i) {
$Destination = "d:\\Drop\\ClsPrf\\$Out_Fi le";
goto Move_File;
} elsif ($Out_File =~ /^cx/i) {
$Destination = "d:\\Drop\\ClsNeg\\$Out_Fi le";
goto Move_File;
} elsif ($Out_File =~ /^dc/i) {
$Destination = "d:\\Drop\\DailyColorNeg\\ $Out_File" ;
goto Move_File;
} elsif ($Out_File =~ /^dx/i) {
$Destination = "d:\\Drop\\DailyNeg\\$Out_ File";
goto Move_File;
} elsif ($Out_File =~ /^tx/i) {
goto OPI;
} elsif ($Out_File =~ /^vp/i) {
$Destination = "d:\\Drop\\ClsDsPrf\\$Out_ File";
goto Move_File;
} elsif ($Out_File =~ /^xp/i) {
goto AdProof;
} goto BADFILENAME;
NewsProof:
if ($Out_File =~ /^ap\w\w[0-9]/i) {
$Destination = "D:\\Drop\\EdTabPrf\\$Out_ File";
goto Move_File;
} elsif ($Out_File =~ /^ap\w\w[a,b,c,d,m,y]/i) {
$Destination = "D:\\Drop\\EdPrf\\$Out_Fil e";
goto Move_File;
} elsif ($Out_File =~ /^ap\w\w[e,f,g,h,j,k,s,u,v ,w,x,z]/i) {
$Destination = "D:\\Drop\\EdAdvPrf\\$Out_ File";
goto Move_File;
} goto BADFILENAME;
AdProof:
if ($Out_File =~ /^xp\w\w[0-9]/i) {
$Destination = "D:\\Drop\\AdTabPrf\\$Out_ File";
goto Move_File;
} elsif ($Out_File =~ /^xp\w\w[a,b,c,d,y]/i) {
$Destination = "D:\\Drop\\AdPrf\\$Out_Fil e";
goto Move_File;
} elsif ($Out_File =~ /^xp\w\w[e,f,g,h,j,k,s,u,v ,w,x,z]/i) {
$Destination = "D:\\Drop\\AdAdvPrf\\$Out_ File";
goto Move_File;
} goto BADFILENAME;
#Send_to_OMan ,a,b,c
STO:
if ($Out_File =~ /^[0-9,A,B,C,D]/i) {
goto AdDir;
} elsif ($Out_File =~ /^g/i) {
$Destination = "e:\\hires\\dk1\\tmp\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^k/i) {
$Destination = "e:\\hires\\dk1\\cls\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^n/i) {
$Destination = "e:\\hires\\dk1\\prm\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^p/i) {
$Destination = "e:\\hires\\dk1\\ctm\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^s/i) {
$Destination = "e:\\hires\\dk1\\cls\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^tf/i) {
$Destination = "e:\\hires\\dk1\\cls\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^x/i) {
$Destination = "e:\\hires\\dk1\\tmp\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^tx/i) {
goto OPI;
} goto BADFILENAME;
$Destination = "e:\\Bad_Filename\\$Out_Fi le";
goto Move_File;
#Parse on the 4th character and move the file to final directory.
AdDir:
if ($Out_File =~ /^\w\w\w0/) {
$Destination = "e:\\hires\\dk1\\ad0\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w1/) {
$Destination = "e:\\hires\\dk1\\ad1\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w2/) {
$Destination = "e:\\hires\\dk1\\ad2\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w3/) {
$Destination = "e:\\hires\\dk1\\ad3\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w4/) {
$Destination = "e:\\hires\\dk1\\ad4\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w5/) {
$Destination = "e:\\hires\\dk1\\ad5\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w6/) {
$Destination = "e:\\hires\\dk1\\ad6\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w7/) {
$Destination = "e:\\hires\\dk1\\ad7\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w8/) {
$Destination = "e:\\hires\\dk1\\ad8\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w9/) {
$Destination = "e:\\hires\\dk1\\ad9\\$Out _File";
goto Move_File;
} goto BADFILENAME;
OPI:
if ($Out_File =~ /^0,1\w\w\wab/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Inco ming\\Apt_ Book\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^0,1\w\w\wff/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Inco ming\\Farm Fresh\\$Ou t_File";
goto Move_File;
} elsif ($Out_File =~ /^0,1\w\w\who/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Inco ming\\Home _Search\\$ Out_File";
goto Move_File;
} elsif ($Out_File =~ /^t/i) {
goto Tab;
} goto BADFILENAME;
Tab:
if ($Out_File =~ /^tx\w\w\wab/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Inco ming\\Apt_ Book\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wal/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl e\\Special _Style\\$O ut_File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wba/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac on\\Baysid e\\$Out_Fi le";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\w(be|cn)/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac on\\$Out_F ile";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wbx/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac on\\Baysid e\\xtra_ba yside\\$Ou t_File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wcc/i) {
$Destination = "e:\\hires\\dk1\\OPI\\coas t\\$Out_Fi le";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wce/i) {
$Destination = "e:\\hires\\dk1\\OPI\\clip per\\east\ \$Out_File ";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\w(cl|pe)/i) {
$Destination = "e:\\hires\\dk1\\OPI\\clip per\\$Out_ File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wco/i) {
$Destination = "e:\\hires\\dk1\\OPI\\comp ass\\$Out_ File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\w(cu|en)/i) {
$Destination = "e:\\hires\\dk1\\OPI\\curr ents\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wcw/i) {
$Destination = "e:\\hires\\dk1\\OPI\\clip per\\west\ \$Out_File ";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wdc/i) {
$Destination = "e:\\hires\\dk1\\OPI\\port _folio\\Do wntown_Con nection\\$ Out_File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wfs/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl e\\Family_ Style\\$Ou t_File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wga/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Gato r\\$Out_Fi le";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\who/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Inco ming\\Home _Search\\$ Out_File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\whr/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl e\\Inside_ Business\\ Inside_Ham pton\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\whs/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl e\\Home_St yle\\$Out_ File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wib/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl e\\Inside_ Business\\ $Out_File" ;
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wis/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl e\\Inside_ Special\\$ Out_File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wke/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac on\\Kempsv ille\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wkx/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac on\\Kempsv ille\\xtra _kempsvill e\\$Out_Fi le";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wlx/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac on\\Lynnha ven\\xtra_ lynnhaven\ \$Out_File ";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wly/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac on\\Lynnha ven\\$Out_ File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wnc/i) {
$Destination = "e:\\hires\\dk1\\OPI\\tvwe ek\\north_ carolina\\ $Out_File" ;
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wof/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac on\\oceanf ront\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wox/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac on\\oceanf ront\\xtra _oceanfron t\\$Out_Fi le";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wpa/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac on\\Prince ss_Anne\\$ Out_File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wpb/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Port _folio\\Po rtfolio_Br ide\\$Out_ File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wpf/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Port _folio\\$O ut_File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wph/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Port _folio\\Po rtfolio_Ho me\\$Out_F ile";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wpp/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Port _folio\\Pe ninsula_Pa rent\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wps/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Port _folio\\Po rtfolio_Sp ecial\\$Ou t_File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wpx/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac on\\Prince ss_Anne\\x tra_prince ss_anne\\$ Out_File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\w(re|rw|tr)/i) {
$Destination = "e:\\hires\\dk1\\OPI\\real estate\\$O ut_File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wri/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl e\\Inside_ Business\\ Inside_Ric hmond\\$Ou t_File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wsg/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Port _folio\\St ockley_Gar dens\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wsh/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl e\\Inside_ Business\\ Inside_Ham pton\\Hamp ton_Specia l\\$Out_Fi le";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wsp/i) {
$Destination = "e:\\hires\\dk1\\OPI\\spec ial\\$Out_ File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wsr/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl e\\Inside_ Business\\ Inside_Ric hmond\\Ric hmond_Spec ial\\$Out_ File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wss/i) {
$Destination = "e:\\hires\\dk1\\OPI\\jobs _today\\$O ut_File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wst/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl e\\$Out_Fi le";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\w(su|ta)/i) {
$Destination = "e:\\hires\\dk1\\OPI\\sun\ \$Out_File ";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wtp/i) {
$Destination = "e:\\hires\\dk1\\OPI\\port _folio\\Ti dewater_Pa rent\\$Out _File";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wtv/i) {
$Destination = "e:\\hires\\dk1\\OPI\\tvwe ek\\$Out_F ile";
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wty/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Circ uit_City\\ $Out_File" ;
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wwa/i) {
$Destination = "e:\\hires\\dk1\\OPI\\welc ome_aboard \\$Out_Fil e";
goto Move_File;
}
BADFILENAME:
`net send nt_omclient_1 "$Out_File is not a legitimate filename or was sent wrong."`;
`net send nt_omclient_2 "$Out_File is not a legitimate filename or was sent wrong."`;
$Destination = "e:\\Bad_Filename\\$Out_Fi le";
goto Move_File;
Move_File:
rename ($In_File, $Destination);
Log:
open (log_file, ">> g:\\tech_logs\\Move_File_L ogs\\File_ Move_$Log_ out_file.t xt");
print log_file ("$In_File M--> $Destination at $execute_time\n");
close (log_file);
End:
#File_Move.pl Moves or copies a file from one folder to another.
#
$currtime = time();
$timelist = localtime ($currtime);
$execute_time = $timelist;
$execute_time =~ s/^.{11}//g;
$execute_time =~ s/.{5}$//g;
$timelist =~ s/[0-9][0-9]:[0-9][0-9]:[0
$Log_out_file = $timelist;
$Log_out_file =~ s/ /_/g;
$Log_out_file =~ s/__2000/_2000/;
$Destination = "";
#Execute Command input queue sends filename with the path.
$In_File = $ARGV[0];
$Out_File = $In_File;
#Strip the path off of the filename
$Out_File =~ s/[a-z,A-Z]:\\//g;
$Out_File =~ s/\w+\\//g;
#Figure out which folder the file came in.
if ($In_File =~ /^d:\\icl_pages\\/i) {
goto ICL;
} elsif ($In_File =~ /^d:\\ClassPS\\/i) {
goto ICL;
} elsif ($In_File =~ /^e:\\Send_to_OMan\\/i) {
goto STO;
} elsif ($In_File =~ /^e:\\OPI_Incoming_Art\\/i
goto OPI;
} elsif ($In_File =~ /^d:\\DTI_Pages\\/i) {
goto DTI;
} elsif ($In_File =~ /^d:\\DTI_11\\/i) {
$Destination = "d:\\Drop\\DTI_11-5\\$Out_
goto Move_File;
} elsif ($In_File =~ /^d:\\DTI_12\\/i) {
$Destination = "d:\\Drop\\DTI_12-5\\$Out_
goto Move_File;
}
DTI:
if ($Out_File =~ /^cp/i) {
$Destination = "d:\\Drop\\DTIClassPrf\\$O
goto Move_File;
} elsif ($Out_File =~ /^cx/i) {
$Destination = "d:\\Drop\\Dti_12-5\\$Out_
goto Move_File;
} goto BADFILENAME;
ICL:
if ($Out_File =~ /^ap/i) {
goto NewsProof;
} elsif ($Out_File =~ /^ax/i) {
$Destination = "d:\\Drop\\AdvNeg\\$Out_Fi
goto Move_File;
} elsif ($Out_File =~ /^cc/i) {
$Destination = "d:\\Drop\\ClsTest\\$Out_F
goto Move_File;
} elsif ($Out_File =~ /^cp/i) {
$Destination = "d:\\Drop\\ClsPrf\\$Out_Fi
goto Move_File;
} elsif ($Out_File =~ /^cx/i) {
$Destination = "d:\\Drop\\ClsNeg\\$Out_Fi
goto Move_File;
} elsif ($Out_File =~ /^dc/i) {
$Destination = "d:\\Drop\\DailyColorNeg\\
goto Move_File;
} elsif ($Out_File =~ /^dx/i) {
$Destination = "d:\\Drop\\DailyNeg\\$Out_
goto Move_File;
} elsif ($Out_File =~ /^tx/i) {
goto OPI;
} elsif ($Out_File =~ /^vp/i) {
$Destination = "d:\\Drop\\ClsDsPrf\\$Out_
goto Move_File;
} elsif ($Out_File =~ /^xp/i) {
goto AdProof;
} goto BADFILENAME;
NewsProof:
if ($Out_File =~ /^ap\w\w[0-9]/i) {
$Destination = "D:\\Drop\\EdTabPrf\\$Out_
goto Move_File;
} elsif ($Out_File =~ /^ap\w\w[a,b,c,d,m,y]/i) {
$Destination = "D:\\Drop\\EdPrf\\$Out_Fil
goto Move_File;
} elsif ($Out_File =~ /^ap\w\w[e,f,g,h,j,k,s,u,v
$Destination = "D:\\Drop\\EdAdvPrf\\$Out_
goto Move_File;
} goto BADFILENAME;
AdProof:
if ($Out_File =~ /^xp\w\w[0-9]/i) {
$Destination = "D:\\Drop\\AdTabPrf\\$Out_
goto Move_File;
} elsif ($Out_File =~ /^xp\w\w[a,b,c,d,y]/i) {
$Destination = "D:\\Drop\\AdPrf\\$Out_Fil
goto Move_File;
} elsif ($Out_File =~ /^xp\w\w[e,f,g,h,j,k,s,u,v
$Destination = "D:\\Drop\\AdAdvPrf\\$Out_
goto Move_File;
} goto BADFILENAME;
#Send_to_OMan ,a,b,c
STO:
if ($Out_File =~ /^[0-9,A,B,C,D]/i) {
goto AdDir;
} elsif ($Out_File =~ /^g/i) {
$Destination = "e:\\hires\\dk1\\tmp\\$Out
goto Move_File;
} elsif ($Out_File =~ /^k/i) {
$Destination = "e:\\hires\\dk1\\cls\\$Out
goto Move_File;
} elsif ($Out_File =~ /^n/i) {
$Destination = "e:\\hires\\dk1\\prm\\$Out
goto Move_File;
} elsif ($Out_File =~ /^p/i) {
$Destination = "e:\\hires\\dk1\\ctm\\$Out
goto Move_File;
} elsif ($Out_File =~ /^s/i) {
$Destination = "e:\\hires\\dk1\\cls\\$Out
goto Move_File;
} elsif ($Out_File =~ /^tf/i) {
$Destination = "e:\\hires\\dk1\\cls\\$Out
goto Move_File;
} elsif ($Out_File =~ /^x/i) {
$Destination = "e:\\hires\\dk1\\tmp\\$Out
goto Move_File;
} elsif ($Out_File =~ /^tx/i) {
goto OPI;
} goto BADFILENAME;
$Destination = "e:\\Bad_Filename\\$Out_Fi
goto Move_File;
#Parse on the 4th character and move the file to final directory.
AdDir:
if ($Out_File =~ /^\w\w\w0/) {
$Destination = "e:\\hires\\dk1\\ad0\\$Out
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w1/) {
$Destination = "e:\\hires\\dk1\\ad1\\$Out
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w2/) {
$Destination = "e:\\hires\\dk1\\ad2\\$Out
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w3/) {
$Destination = "e:\\hires\\dk1\\ad3\\$Out
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w4/) {
$Destination = "e:\\hires\\dk1\\ad4\\$Out
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w5/) {
$Destination = "e:\\hires\\dk1\\ad5\\$Out
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w6/) {
$Destination = "e:\\hires\\dk1\\ad6\\$Out
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w7/) {
$Destination = "e:\\hires\\dk1\\ad7\\$Out
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w8/) {
$Destination = "e:\\hires\\dk1\\ad8\\$Out
goto Move_File;
} elsif ($Out_File =~ /^\w\w\w9/) {
$Destination = "e:\\hires\\dk1\\ad9\\$Out
goto Move_File;
} goto BADFILENAME;
OPI:
if ($Out_File =~ /^0,1\w\w\wab/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Inco
goto Move_File;
} elsif ($Out_File =~ /^0,1\w\w\wff/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Inco
goto Move_File;
} elsif ($Out_File =~ /^0,1\w\w\who/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Inco
goto Move_File;
} elsif ($Out_File =~ /^t/i) {
goto Tab;
} goto BADFILENAME;
Tab:
if ($Out_File =~ /^tx\w\w\wab/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Inco
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wal/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wba/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\w(be|cn)/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wbx/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wcc/i) {
$Destination = "e:\\hires\\dk1\\OPI\\coas
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wce/i) {
$Destination = "e:\\hires\\dk1\\OPI\\clip
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\w(cl|pe)/i) {
$Destination = "e:\\hires\\dk1\\OPI\\clip
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wco/i) {
$Destination = "e:\\hires\\dk1\\OPI\\comp
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\w(cu|en)/i) {
$Destination = "e:\\hires\\dk1\\OPI\\curr
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wcw/i) {
$Destination = "e:\\hires\\dk1\\OPI\\clip
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wdc/i) {
$Destination = "e:\\hires\\dk1\\OPI\\port
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wfs/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wga/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Gato
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\who/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Inco
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\whr/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\whs/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wib/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wis/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wke/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wkx/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wlx/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wly/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wnc/i) {
$Destination = "e:\\hires\\dk1\\OPI\\tvwe
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wof/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wox/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wpa/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wpb/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Port
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wpf/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Port
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wph/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Port
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wpp/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Port
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wps/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Port
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wpx/i) {
$Destination = "e:\\hires\\dk1\\OPI\\beac
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\w(re|rw|tr)/i) {
$Destination = "e:\\hires\\dk1\\OPI\\real
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wri/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wsg/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Port
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wsh/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wsp/i) {
$Destination = "e:\\hires\\dk1\\OPI\\spec
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wsr/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wss/i) {
$Destination = "e:\\hires\\dk1\\OPI\\jobs
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wst/i) {
$Destination = "e:\\hires\\dk1\\OPI\\styl
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\w(su|ta)/i) {
$Destination = "e:\\hires\\dk1\\OPI\\sun\
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wtp/i) {
$Destination = "e:\\hires\\dk1\\OPI\\port
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wtv/i) {
$Destination = "e:\\hires\\dk1\\OPI\\tvwe
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wty/i) {
$Destination = "e:\\hires\\dk1\\OPI\\Circ
goto Move_File;
} elsif ($Out_File =~ /^tx\w\w\wwa/i) {
$Destination = "e:\\hires\\dk1\\OPI\\welc
goto Move_File;
}
BADFILENAME:
`net send nt_omclient_1 "$Out_File is not a legitimate filename or was sent wrong."`;
`net send nt_omclient_2 "$Out_File is not a legitimate filename or was sent wrong."`;
$Destination = "e:\\Bad_Filename\\$Out_Fi
goto Move_File;
Move_File:
rename ($In_File, $Destination);
Log:
open (log_file, ">> g:\\tech_logs\\Move_File_L
print log_file ("$In_File M--> $Destination at $execute_time\n");
close (log_file);
End:
just about every other line of that program has pattern matching statements ( /blah/ is a pattern ) and those would be quite hard to translate to vb, it's not built in to that language... any way you could just install perl and use the script as is? perl is available for free on windows or unix
ASKER
Adjusted points from 400 to 500
ASKER
Are you saying that it is difficult for VB to look at a file name, break it down into sections, and move it to another folder? I know very little about Perl and know a small amount of VB but I have a hard time believing that it's that difficult to do. The structure seems like it would be very similar to Perl.
It seems as though the $ at the top of the script are much like Dim statements, the next section calls a function for each type of file based on the characters in the name, the functions follow, and the end is for error handling.
My objective here is to convert the script to VB so that I can build a form and build a graphical interface so operators can watch what is occurring. The script is presently running and working - however - I want to convert it to VB, that's why I posted the question.
It seems as though the $ at the top of the script are much like Dim statements, the next section calls a function for each type of file based on the characters in the name, the functions follow, and the end is for error handling.
My objective here is to convert the script to VB so that I can build a form and build a graphical interface so operators can watch what is occurring. The script is presently running and working - however - I want to convert it to VB, that's why I posted the question.
ok, thanks for the clarification... the $ is just a symbol that precedes any scalar variable name, there are no declarations in perl, varaibles are just used on the fly
since the perl script seems to require no user interaction why don't you just create a vb front end that runs the perl script with a system call?
since the perl script seems to require no user interaction why don't you just create a vb front end that runs the perl script with a system call?
ASKER
The company I work for is moving away from Perl, Java, CGI, etc. and trying to put everything in C, VB, VBA. Not my choice, theirs.
ok, i'll give it a shot after i get back from work tonight...
ASKER
Thanks - sorry for all the miscommunication.
ok, i have it ready but rather than post 400 lines of code it would be nice to email you the vb project. i have visual basic version 5 but if yours is newer i'm sure it will convert the project for you
please post your email address or send it to adammitz@hotmail.com if you don't feel comfortable posting it.
please post your email address or send it to adammitz@hotmail.com if you don't feel comfortable posting it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great - thank-you