Retrieving filenames and inputting into another bat file?
Posted: 19 Feb 2009 21:18
Hey guys,
I'm new to batch files and I'm really stuck!
I've been put in charge of automating the backing up and restoring of some interbase databases at work. It's hard!
Here's my situation:
There are a few databases in this directory:
C:\MT32\data\
Eg, C:\MT32\data\database1.IB, database2.IB, database3.IB, database4.IB, etc...
I NEED 2 BATCH FILES!
The first bat file will search the directory where the databases are located, retrieve the filename of the first database, and input that into a few commands in a second bat file. Then repeat the process for the second database, and third database, and fourth, etc...
Here is what the main part of my second bat file looks like:
"C:\Program Files\Borland\InterBase\bin\gbak" -B -USER SYSDBA -PASSWORD masterkey -y "C:\MT32\GBAK Backup\FILENAME.log" "C:\MT32\data\FILENAME.IB" "C:\MT32\GBAK Backup\FILENAME.GBK"
So for my first bat file, what command will I use to retrieve the filenames of the databases and input them into the red highlighted sections of the second bat file?
I've tried plaving around with the FOR IN () DO COMMAND but no joy.
I would greatly appreciate any help on this matter.
Rock on
-Kev
I'm new to batch files and I'm really stuck!
I've been put in charge of automating the backing up and restoring of some interbase databases at work. It's hard!
Here's my situation:
There are a few databases in this directory:
C:\MT32\data\
Eg, C:\MT32\data\database1.IB, database2.IB, database3.IB, database4.IB, etc...
I NEED 2 BATCH FILES!
The first bat file will search the directory where the databases are located, retrieve the filename of the first database, and input that into a few commands in a second bat file. Then repeat the process for the second database, and third database, and fourth, etc...
Here is what the main part of my second bat file looks like:
"C:\Program Files\Borland\InterBase\bin\gbak" -B -USER SYSDBA -PASSWORD masterkey -y "C:\MT32\GBAK Backup\FILENAME.log" "C:\MT32\data\FILENAME.IB" "C:\MT32\GBAK Backup\FILENAME.GBK"
So for my first bat file, what command will I use to retrieve the filenames of the databases and input them into the red highlighted sections of the second bat file?
I've tried plaving around with the FOR IN () DO COMMAND but no joy.
I would greatly appreciate any help on this matter.
Rock on
-Kev