Page 1 of 1

how to move a file to new location with time stamp

Posted: 09 May 2014 4:22
by SKSKD
Suppose my file in X location is ->ABCD.txt

Move to Y location with appending timestamp.
like
ABCD.20140509094707.txt

What i did

But the out put I am getting in job after difined a variable is
ABCD.20140509094707txt

Where variable defined is
%%TIMEST=%%$DATE.%%TIME
And command is
move D:\ABCD.txt D:\DD\ABCD.%%TIMEST.txt

But the output is ABCD.20140509094707txt

so file type is not recognized as .txt as "." missing before "txt"

Thanks for your valuable inputs here
I am working on Control-M V8

Posted: 10 May 2014 5:23
by jCarlos
could you try something like:

move D:\ABCD.txt D:\DD\ABCD."%%TIMEST".txt

or

move D:\ABCD.txt D:\DD\ABCD."%TIMEST%".txt

or set a cmd variable like:

set ts=%%TIMEST & move D:\ABCD.txt D:\DD\ABCD."%ts%".txt

i don't have the enviroment to test right now, the last one will work as you are using "move" so you are using a windows based os.

Posted: 13 May 2014 6:12
by SKSKD
jCarlos wrote:could you try something like:

move D:\ABCD.txt D:\DD\ABCD."%%TIMEST".txt

or

move D:\ABCD.txt D:\DD\ABCD."%TIMEST%".txt

or set a cmd variable like:

set ts=%%TIMEST & move D:\ABCD.txt D:\DD\ABCD."%ts%".txt

i don't have the enviroment to test right now, the last one will work as you are using "move" so you are using a windows based os.
Thanks Carlos,

It working fine for me.

Thanks once again

Posted: 15 May 2014 5:24
by jCarlos
I'm glad I could be of assistance :)

Posted: 19 May 2014 11:04
by matom
Hi SKSKD,

Use two consecutive « . » to include one in your file name.

Your command is :
move D:\ABCD.txt D:\DD\ABCD.%%TIMEST..txt

Regards

Posted: 19 May 2014 4:59
by ThePirate
If you are using the CM for Advanced File Transfer to move the file use below

for D:\DD\$$AFTFILE$$.%%$DATE.%%TIME for ABCD.yyyymmddhhmmss.txt (need dot after last $ sign to get the dot after ABCD)

and use D:\DD\$$AFTFILE$$%%$DATE.%%TIME for ABCDyyyymmddhhmmss.txt but I think you are using some kind of script.