troubleshooting Question

Adding a date to a file name in a bat file so that every day will be a different name

Avatar of LindaC
LindaCFlag for Puerto Rico asked on
Windows Server 2003Windows Batch
5 Comments1 Solution300 ViewsLast Modified:
I want to execute an oracle export but the name of the dump file I want to add the day-month-and year so that each day the dump file be created with a different name.
Don't worry about disk space because I have another script which removes dump files older than 4 days:
This is the script that Iám using:

set a=exp_oem10g_%DATE:.=%
set b=oem10g_%DATE:.=%
E:\oracle\product\10.2.0\db_1\BIN\expdp.exe backup_user/backup_user dumpfile=dpump_dir1:%b%.dmp filesize=0 content=all logfile=dpump_log1:%a%.log full=y
date /t >> E:\oracle\Dba\logs\%a%.log
cd \progra~1\tivoli\tsm\baclient
dsmc incremental E:\oracle\Dba\exports\%b%.dmp >> E:\oracle\Dba\logs\%a%.log
date /t >> E:\oracle\Dba\logs\%a%.log

The logfile it is written as exp_oem10g_Tue (type File) and the dump file is not written because it is like this:

What I want is that the dumpfile it is written as oem10g_2-27-07.dmp  and the logfile as exp_oem10g_2-27-0.log --------------> The date of today

Incremental backup of volume 'E:\oracle\Dba\exports\oem10g_Tue'

Incremental backup of volume '02/27/2007.dmp' ----------->

Incremental backup of volume '02/27/2007.log'----------> This is supposed to be the log file
Tue 02/27/2007

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros