PrimaveraTard
MIS
back again, still lost.
I am creating txt files and storing the data from an oracle database in them. I can create the files fine, as long as I point to the right directory. I want to create the directory, in the same manner I create the file and name it the date of the backup. Is this possible? Below is the code that doesn't work (it does create the txt file,but no directory), but I think it will give you an idea of what I'm trying to do. Thanks.
my $table_Name = param('table_name');
my $date = $ENV{'DATE_LOCAL'};
my $sql = qq{SELECT * FROM "$table_Name" };
#Prepare the SQL and execute.
my $sth = $dbh->prepare( $sql );
$sth->execute();
#Fetch output rows into array, plus prepare a
#print formatter for the results.
while ( my @String = $sth->fetchrow_array) {
#Print out the result
my $data="$table_Name.txt";
open(DAT,">>../DPRIS Backup Data Files/$date/$data"
|| die("Cannot Open File"
;
print DAT "'";
print DAT join "', '", @String;
print DAT "'";
print DAT "\n";
close(DAT);
}
I am creating txt files and storing the data from an oracle database in them. I can create the files fine, as long as I point to the right directory. I want to create the directory, in the same manner I create the file and name it the date of the backup. Is this possible? Below is the code that doesn't work (it does create the txt file,but no directory), but I think it will give you an idea of what I'm trying to do. Thanks.
my $table_Name = param('table_name');
my $date = $ENV{'DATE_LOCAL'};
my $sql = qq{SELECT * FROM "$table_Name" };
#Prepare the SQL and execute.
my $sth = $dbh->prepare( $sql );
$sth->execute();
#Fetch output rows into array, plus prepare a
#print formatter for the results.
while ( my @String = $sth->fetchrow_array) {
#Print out the result
my $data="$table_Name.txt";
open(DAT,">>../DPRIS Backup Data Files/$date/$data"
print DAT "'";
print DAT join "', '", @String;
print DAT "'";
print DAT "\n";
close(DAT);
}