问题
Following is my command to copy the files in my computer and from my computer to network.
ROBOCOPY "K:\Builds" F:\Builds\ /E /COPY:DAT
ROBOCOPY "E:\" "K:\Shan Khan\" /E /COPY:DAT
How i can make timestamp in destination folder only when copying the file for example
"K:\Builds" when copied to F:\Builds\
F:\Builds\ ---> F:\Builds_26092015
"E:\" when copied to "K:\Shan Khan\Workspace"
"K:\Shan Khan\Workspace"---> "K:\Shan Khan\Workspace_26092015"
Kindly note that K drive is password protected and i manually saved the password while mapping the IP address to K drive.
回答1:
I tried this lines and it works. it created the directory in such a way Fri 06_26_2015
for /f "tokens=1* delims=" %%a in ('date /T') do set datestr=%%a
md F:\Builds\"%date:/=_%"
ROBOCOPY "K:\Builds" "F:\Builds\%date:/=_%" /E /COPY:DAT /DCOPY:T
来源:https://stackoverflow.com/questions/31064976/how-to-use-robocopy-to-copy-files-with-timestamp-in-command-line