How to use Robocopy to copy files with TimeStamp i

2019-05-18 18:44发布

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

  1. "K:\Builds" when copied to F:\Builds\

        F:\Builds\ ---> F:\Builds_26092015
    
  2. "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条回答
时光不老,我们不散
2楼-- · 2019-05-18 19:20

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
查看更多
登录 后发表回答