I have bat file to run sql procedure which is creating 2 files:
TEST_SCHEMA.dmp
TEST_SCHEMA.log
Then I used xcopy to copy files. After copy I want to change the file name to:
TEST_SCHEMA.dmp -> TEST_CURRENT_DATE.dmp
TEST_SCHEMA.log -> TEST_CURRENT_DATE.log
where Current_Date = YYYYMMDDHHMM
This is what I had so far:
set OWNER=myOwner
set FILE_NAME=TEST_SCHEMA
set NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
sqlplus %OWNER%/%OWNER%@host:1521/SID @run_test.sql %OWNER% %FILE_NAME%
xcopy "\\host\c$\abc\def\test\%FILE_NAME%.*" /C
set "_year=%MyDate:~0,4%"
set "_month=%MyDate:~4,2%"
set "_day=%MyDate:~6,2%"
ren FILE_NAME.dmp "TEST (%_year%%_month%%_day%).txt"
ren FILE_NAME.log "TEST (%_year%%_month%%_day%).txt"
pause 0
Result should be like:
TEST_201806131006.dmp
TEST_201806131006.log
But I don't know how to correctly use rename and put date to file name.