robocopy 功能强大的 命令行 模式备份软件的简体中文 使用说明

--引自《刘辉的博客:http://anywolfs.com/liuhui/article.asp?id=210

             Usage :: ROBOCOPY source destination [file [file]...] [options]
使用规则:robocopy 源目录 文件 参数

             source :: Source Directory (drive:\path or \\server\share\path).
源:源目录包括 (盘符:\路径 或 \\服务器\\共享目录\路径)

        destination :: Destination Dir  (drive:\path or \\server\share\path).
目录::目录路径(盘符:\路径 或 \\服务器\共享目录\路径)

               file :: File(s) to copy  (names/wildcards: default is "*.*").
文件:被copy的文件 (文件名或文件类型:默认情况下是所有文件*.*)

::
:: Copy options :
copy参数
::
                 /S :: copy Subdirectories, but not empty ones.
/s表示包括除空文件下的所有子目录,如果没有则仅复制指定目录下的文件而不包括子目录

                 /E :: copy subdirectories, including Empty ones.
/e表示复制所有子目录包括空文件夹

             /LEV:n :: only copy the top n LEVels of the source directory tree.
/lev:n表示复制的层级,比如指定层级后c:\windows\temp(二级)下的文件会被复制,而c:\windows\temp\downloads(三级)下的文件则不被复制

                 /Z :: copy files in restartable mode.
/z以启动模式下拷贝文件

                 /B :: copy files in Backup mode.
以备份模式copy文件

                /ZB :: use restartable mode; if access denied use Backup mode.
/zb表示优先使用启动模式,否则使用备份模式

  /COPY:copyflag[s] :: what to COPY (default is /COPY:DAT).
                       (copyflags : D=Data, A=Attributes, T=Timestamps).
                       (S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
/copy包含参数datsou比如:/copy:datsou(也可以用/copyall),表示将所有源文件夹的信息复制到目标文件夹中,其中D=文件数据,A=文件属性,T=时间信息,S=权限信息,O=所有者信息,U=审核信息。

               /SEC :: copy files with SECurity (equivalent to /COPY:DATS).
/sec表示copy文件并带安全属性信息,等同于/copy:dats

           /COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).
/copyall等同于/copy:datsou

            /NOCOPY :: COPY NO file info (useful with /PURGE).
/nocopy表示copy文件不附带任何属性信息

             /PURGE :: delete dest files/dirs that no longer exist in source.
               /MIR :: MIRror a directory tree (equivalent to /E plus /PURGE).
/mir的作用等同于/purge /e,/purge表示清理目标文件夹有而源文件夹里没有的文件(夹)。通过这个命令,能保证源文件夹和目标文件夹结构与文件完全相同。这在创建镜像备份时,非常有用。


               /MOV :: MOVe files (delete from source after copying).
/mov表示当从源文件移动到目的地以后,将源文件删除,只作用于文件,不作用于目录。

              /MOVE :: MOVE files AND dirs (delete from source after copying).
/move表示把源文件和目录结构都移动到目的地,源位置文件和目录结构都会被删除,起剪贴作用

       /A+:[RASHNT] :: add the given Attributes to copied files.
       /A-:[RASHNT] :: remove the given Attributes from copied files.
/a+、/a- 等参数表示对文件属性进行操作,分别表示在文件被拷贝后为文件添加、去除某属性

            /Create :: Create directory tree and zero-length files only.
/create表示只创建目录结构并创建0长度的文件。目的是只要文件结构的情况下。

               /FAT :: create destination files using 8.3 FAT file names only.
               /FFT :: assume FAT File Times (2-second granularity).
               /256 :: turn off very long path (> 256 characters) support.

             /MON:n :: MONitor source; run again when more than n changes seen.
             /MOT:m :: MOnitor source; run again in m minutes Time, if changed.
/mot后接的是时间(分钟),是指Robocopy执行操作的最短时间;/mon后接的是最少文件修改个数。在监视过程中,会自动记录时间和修改的次数,只有同时符合以上两个条件时,Robocopy才开始执行,执行完成后,这两个数据会自动清零,并重新开始监视文件夹,除非用户关闭命令提示符窗口或按下Ctrl+Break键.

          /RH:hhmm-hhmm :: Run Hours - times when new copies may be started.
/RH:hhmm-hhmm指定Robocopy开始的时间段和结束时间段,在这个时间段外,拷贝会被暂停。时间为24小时格式,4个数字长,从0000到2359,而且两个数字不能相同

                /PF :: check run hours on a Per File (not per pass) basis.

             /IPG:n :: Inter-Packet Gap (ms), to free bandwidth on slow lines.

::
:: File Selection Options :
文件可选属性
::
                 /A :: copy only files with the Archive attribute set.
                 /M :: copy only files with the Archive attribute and reset it.
/a表示只copy存档属性的文件,/m表示将只具有存档属性的文件拷贝到目标盘后,将拷贝生成的文件的存档属性去掉。


    /IA:[RASHCNETO] :: Include only files with any of the given Attributes set.
    /XA:[RASHCNETO] :: eXclude files with any of the given Attributes set.
/xa:[属性],/xa:h表示将具有隐藏属性的排除出复制范围,与之相对应的是/ia,表示包括只对拥有指定属性的执行操作。属性有R:只读,A:存档,S:系统,H:隐藏等几种供选择

/XF file [file]... :: eXclude Files matching given names/paths/wildcards.
/XD dirs [dirs]... :: eXclude Directories matching given names/paths.
/xf为指定不执行复制操作的文件类型,后面的文件名支持通配符(/xf *.tmp *.bak)。/xd表示排除后面指定的文件夹.

                /XC :: eXclude Changed files.
/xc不执行拷贝改变过得文件
                /XN :: eXclude Newer files.
/xn不copy新曾文件
                /XO :: eXclude Older files.
/不copy老文件
                /XX :: eXclude eXtra files and directories.
/保持现有文件现状,只更新,不执行多余的文件或目录
                /XL :: eXclude Lonely files and directories.

                /IS :: Include Same files.
/is文件相同,不做copy,但是文件的属性进行更新,经常和/copy一起结合使用比如:robocopy c:\windows\temp c:\windows\temp\downloads /is /copy:sou

                /IT :: Include Tweaked files.

             /MAX:n :: MAXimum file size - exclude files bigger than n bytes.
             /MIN:n :: MINimum file size - exclude files smaller than n bytes.
/max:n /max:6000000表示仅复制不大于6000000bytes的文件,数值单位为byte。如果是/min:6000000,则复制不小于6000000bytes的文件。两个参数可以同时使用,界定复制文件大小的范围

          /MAXAGE:n :: MAXimum file AGE - exclude files older than n days/date.
          /MINAGE:n :: MINimum file AGE - exclude files newer than n days/date.
/maxage:n表示最远修改时间的文件,修改时间比这个还要旧的文件将不会被复制。/maxage:后可接数字,也可以接日期,数字小于1900时表示天数,否则就得用YYYYMMDD来表示具体的日期,如/maxage:20070110表示2007年1月10日后被修改的文件才允许复制。与之相对应的参数是/minage,表示最近修改时间,比这个时间新的文件将不被复制。

          /MAXLAD:n :: MAXimum Last Access Date - exclude files unused since n.
          /MINLAD:n :: MINimum Last Access Date - exclude files used since n.
                       (If n < 1900 then n = n days, else n = YYYYMMDD date).

                /XJ :: eXclude Junction points. (normally ncluded by default).

::
:: Retry Options :
::
               /R:n :: number of Retries on failed copies: default 1 million.
/r:n重试次数,当复制出错时,重新尝试复制的次数,默认时一百万次
               /W:n :: Wait time between retries: default is 30 seconds.
/w:n表示当上次一重试复制失败后下一次开始的时间间隔,默认时30秒

               /REG :: Save /R:n and /W:n in the Registry as default settings.
/reg 使用/reg以后,表示将/w:n /r:n一起结合使用,并取他们的默认参数值。

               /TBD :: wait for sharenames To Be Defined (retry error 67).

::
:: Logging Options :
日志输出参数
::
                 /L :: List only - don't copy, timestamp or delete any files.
                 /X :: report all eXtra files, not just those selected.
                 /V :: produce Verbose output, showing skipped files.
                /TS :: include source file Time Stamps in the output.
                /FP :: include Full Pathname of files in the output.

                /NS :: No Size - don't log file sizes.
                /NC :: No Class - don't log file classes.
               /NFL :: No File List - don't log file names.
               /NDL :: No Directory List - don't log directory names.

                /NP :: No Progress - don't display % copied.
/np表示不显示copy进度,在robocopy里面进度大叫以%显示。

               /ETA :: show Estimated Time of Arrival of copied files.
/eta总结复制过的文件花去的时间

          /LOG:file :: output status to LOG file (overwrite existing log).
         /LOG+:file :: output status to LOG file (append to existing log).
默认情况下,Robocopy的操作过程只是在命令提示符中显示,我们可以让它把操作过程输出为TXT文件,加上“/log:文件名.txt”即可

               /TEE :: output to console window, as well as the log file.

               /NJH :: No Job Header.
               /NJS :: No Job Summary.

::
:: Job Options :
::
       /JOB:jobname :: take parameters from the named JOB file.
      /SAVE:jobname :: SAVE parameters to the named job file
/save:任务名 可以将当前操作记录为任务文件,通过 /job:任务名

就可以方便调用,不需要再输入一长串的命令了

              /QUIT :: QUIT after processing command line (to view parameters).
/quit 命令行完成之后,退出程序

              /NOSD :: NO Source Directory is specified.
              /NODD :: NO Destination Directory is specified.
                /IF :: Include the following Files.
原文地址:https://www.cnblogs.com/liunatural/p/1145320.html