PrimaveraTard
MIS
Here's the problem. I am taking data from an Oracle database, and putting it into a text file. I want to name a directory to put the text files into by using the DATE_LOCAL ENV var. But, the format of the DATE_LOCAL var includes the time like this hr:min:sec. That creates 2 problems: 1. Win file naming conventions won't allow the ":" in folder names and 2. Even if it did, it would create a new folder for each file (I have multiple tables to back up) because the backups would be conducted at different times. Below is some code to help.
The code works to create a directory named folder_name and puts the file $table_Name.txt in it. I want to replace folder_name with the date the backup was conducted without having to change my code for each backup.
while ( my @String = $sth->fetchrow_array) {
#Print out the result
my $data="$table_Name.txt";
mkdir ../Backup Data Files/folder_name"
;
open(DAT,">>../Backup Data Files/folder_name/$data"
|| die("Cannot Open File"
;
print DAT "'";
print DAT join "', '", @String;
print DAT "'";
print DAT "\n";
close(DAT);
}
The code works to create a directory named folder_name and puts the file $table_Name.txt in it. I want to replace folder_name with the date the backup was conducted without having to change my code for each backup.
while ( my @String = $sth->fetchrow_array) {
#Print out the result
my $data="$table_Name.txt";
mkdir ../Backup Data Files/folder_name"
open(DAT,">>../Backup Data Files/folder_name/$data"
print DAT "'";
print DAT join "', '", @String;
print DAT "'";
print DAT "\n";
close(DAT);
}