demunchkin
MIS
We've been working with this batch file for several weeks now.
The goal: to copy a file to another server daily and delete the file instance on the first server; to rename the file with the current date on the new server; to check against the last formatted date before copy and delete (the file should not copy if the last formatted date does not equal the current date)
What works: copy, rename, and delete works great
What does not work: the file still copies and deletes regardless of whether the last formatted date matches the current date or not. We have tried the XCOPY command and the XXCOPY command.
The following is the latest attempt:
@echo off
for /F "tokens=2,3,4 delims=/ " %%i in ("%date%") do set DateStamp=%%k%%i%%j
for /F "tokens=1,2,3 delims=:. " %%i in ("%time%") do set TimeStamp=%%i%%j%%k
xxcopy C:\Cold_Results\cold#2.dat \\hpfstore\global$\cold\coldin\pathology\ /DA:.
ren \\hpfstore\global$\cold\coldin\pathology\cold#2.dat %DateStamp%%TimeStamp%.dat
del C:\Cold_Results\cold#2.dat
Any thoughts and suggestions would be greatly appreciated.
Thanks,
Devin
The goal: to copy a file to another server daily and delete the file instance on the first server; to rename the file with the current date on the new server; to check against the last formatted date before copy and delete (the file should not copy if the last formatted date does not equal the current date)
What works: copy, rename, and delete works great
What does not work: the file still copies and deletes regardless of whether the last formatted date matches the current date or not. We have tried the XCOPY command and the XXCOPY command.
The following is the latest attempt:
@echo off
for /F "tokens=2,3,4 delims=/ " %%i in ("%date%") do set DateStamp=%%k%%i%%j
for /F "tokens=1,2,3 delims=:. " %%i in ("%time%") do set TimeStamp=%%i%%j%%k
xxcopy C:\Cold_Results\cold#2.dat \\hpfstore\global$\cold\coldin\pathology\ /DA:.
ren \\hpfstore\global$\cold\coldin\pathology\cold#2.dat %DateStamp%%TimeStamp%.dat
del C:\Cold_Results\cold#2.dat
Any thoughts and suggestions would be greatly appreciated.
Thanks,
Devin