i just wrote some code that finds a zip file in a folder, unzips it using system() call to winzip32.exe.
the contents of zip is an oracle dmp file. I next use another system() call to oracles imp command to import the dmp file to a schema in oracle. It works just fine. What I need to do now is copy the contents of the shell window output to a text file so that i can look later to see if it worked correctly..
Expand|Select|Wrap|Line Numbers
- use warnings;
- use strict;
- my $InDir="D:\\temp";
- my @TempDir;
- opendir(DIR, $InDir) or die "Unable to open dir $InDir: $!\n";
- @TempDir = reverse sort readdir(DIR);
- my $tmp_dir = $TempDir[2];
- close(DIR);
- #$tmp_dir is now the most recent t.com archive
- my $winzip="C:\\Progra~1\\WinZip\\winzip32\.exe -min -e -o $InDir\\$tmp_dir $InDir";
- func1();
- my @TempDir2;
- opendir(DIR, $InDir) or die "Unable to open dir $InDir: $!\n";
- @TempDir2 = reverse sort readdir(DIR);
- my $tmp_dir2 = $TempDir[3];
- close(DIR);
- #$tmp_dir2 is now the most recent unzipped t.com archive
- my $oracle="imp user/password\@instance FROMUSER=fuser TOUSER=tuser FILE=$InDir\\$tmp_dir2 TABLES=($tmp_dir2) FEEDBACK=1000000 LOG=$InDir\\logs\\$tmp_dir2\.log";
- func2();
- sub func1{
- system "$winzip";
- }
- sub func2{
- system "$oracle";
- }
D:\data\scripts>test.pl
D:\data\scripts>
C:\Progra~1\WinZip\winzip32.exe -min -e -o D:\temp\TMP2.zip D:\temp
D:\data\scripts>
imp user/password@instance FROMUSER=fuser TOUSER=tuser FILE=D:\temp\TMP2.dmp TABLES=(TMP2) FEEDBACK=1000000
LOG=D:\temp\TMP2.dmp.log
Import: Release 10.2.0.1.0 - Production on Thu Apr 24 15:14:17 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit
Production
With the Partitioning, OLAP and Data Mining options
Export file created by EXPORT:V10.02.01 via conventional path
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
. importing USER's objects into USER
. . importing table "TMP2"
477438 rows imported
Import terminated successfully without warnings.
so is it possible to have that all exported out to a text file?
Thanks ahead of time