Use the RENAME or REN command.
I don't know about the File date (IMHO you should use PowerShell for that) but the current date and time can be used in commandline operations with these two shell variables:
%date% = returns the current date in the local format
%time% = returns the current time in the local format
You can lift parts of these strings by using this format:
where n is the start position and m is the length of the substring you need. The same format applies to %time%.
For example, if the current date is printed as "Tu 13/01/2015", then
ECHO %date:~9,4% will get you the year.
Use these variables in the specification for the target name, like
REN ABC.QVD ABC-%date:~9,4%%date:~6,2%%date:~3,2%.QVD
In any case, using CMD.EXE batch files to reach your goal will always seem like a dated and limited method.
Edit: Indices start at 0 (zero)
I am in need of moving log file from server to my NAS drive. Server has access to NAS. I would like to try your method but not sure how to. Is this what need to be written in the QVW script:
Set vExec = "C:\IBM\1.qvw.log" "C:\IBM\1\1.qvw.log";
cmd.exe /C xcopy $(vExec) /Y;
Please could you guide.
You can get the File Time of the source file with the FileTime() function and append it to the target filename in your vExec variable. You can use the date and date format functions to get the file's timestamp into a format you like.
Personally, I would've created separate variables for the source and target locations/filenames to make it easier to track, but your method should be OK as well.