@ECHO OFF
:parameter 1- Backup Dir
:parameter 2- Hash dir
:parameter 3- Sequential dir
:Echo this is batch file
@For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @(
Set Month=%%A
Set Day=%%B
Set Year=%%C
)
set hashbackpath= %1\\%Day%-%Month%-%Year%\\Hashed
set seqbackpath= %1\\%Day%-%Month%-%Year%\\Sequential\\Output
md %hashbackpath%
xcopy %2\*.* %hashbackpath% /e /y
md %seqbackpath%
xcopy %3\Output\*.* %seqbackpath% /e /y
PAUSE
When i run the script from the command prompt it works fine but when i call it from the job it only creates the folders but it doesn't copy anything to the folders.
Are you passing in fully qualified paths for each directory?
What happens if you comment out the '@ECHO OFF' and capture the screen output into you job's log? That may help figure out what is going on. However, the most common problem is the use of relative paths in scripts called from DataStage jobs.
-craig
"You can never have too many knives" -- Logan Nine Fingers
Those xcopy commands certainly should echo out what they are doing and be captured in the log. What exactly do you have in the Command and Parameter options inside the Command Activity stage?
I don't see anything obvious. Perhaps some bread crumbs would help... add echo statements at key points, in particular echo out the value of the %hashbackpath% and %seqbackpath% variables after you set them, then check the log again.
-craig
"You can never have too many knives" -- Logan Nine Fingers
Just checked the help on XCOPY. Maybe you need a /D switch?
/D:m-d-y Copies files changed on or after the specified date.
If no date is given, copies only those files whose
source time is newer than the destination time.
Yes, I'm running out of ideas, and clutching at straws.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
In other words, we've done what we can do sitting on the other side of your monitor. Now it's time to find someone on the same side of the glass as you and get another pair of eyes involved.
Hopefully someone DOS batch savvy.
-craig
"You can never have too many knives" -- Logan Nine Fingers
Hi Ray
I have used the /d switch but the same thing. . I like to thank both u and craig for trying. I m really lost at the moment . The "copy" command works, the "move" command also works only the "xcopy" aint working. But copy and move command are not what i need. what i need to do is copy all the subfolders in a folder.
I have also written a c++ program which calls that batch file with parameters and i try to call the exe file from the Command Activity Stage, but still the same thing.