如何在命令行中使用Robocopy使用TimeStamp复制文件 [英] How to use Robocopy to copy files with TimeStamp in command line

查看:64
本文介绍了如何在命令行中使用Robocopy使用TimeStamp复制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的命令,用于将计算机中的文件以及从计算机中的文件复制到网络.

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"复制到F:\ Builds \

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

    F:\Builds\ ---> F:\Builds_26092015

  • 复制到"K:\ Shan Khan \ Workspace"中的"E:\"

  • "E:\" when copied to "K:\Shan Khan\Workspace"

      "K:\Shan Khan\Workspace"---> "K:\Shan Khan\Workspace_26092015"   
    

  • 请注意, K驱动器受密码保护,我在将IP地址映射到K驱动器时手动保存了密码.

    Kindly note that K drive is password protected and i manually saved the password while mapping the IP address to K drive.

    推荐答案

    我尝试了这一行,并且可以正常工作.它以这种方式创建目录2015年6月26日星期五

    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
    

    这篇关于如何在命令行中使用Robocopy使用TimeStamp复制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆