【问题标题】:Does robocopy always add the option "/S" for "/E"?robocopy 是否总是为“/E”添加选项“/S”?
【发布时间】:2019-02-09 00:59:26
【问题描述】:

当我这样做时

robocopy ./empty_folders ./empty_folders_dest /E 

我看到以下选项:

Options : *.* /S /E /DCOPY:DA /COPY:DAT /R:1000000 /W:30

参数/S(不包括空目录)如何进入那里,被/E 逻辑排除(包括空目录)?倒数(逻辑上)不正确:当我做/S 时,我看不到/E

更多细节:

wmic datafile where name="C:\\Windows\\System32\\robocopy.exe" get Version /value
Version=10.0.16299.15

ver
Microsoft Windows [Version 10.0.16299.125]

【问题讨论】:

标签: windows-10 robocopy


【解决方案1】:

您误解了文档。运行“robocopy /???”查看完整的内置帮助。

/S :: copy Subdirectories, but not empty ones.
/E :: copy subdirectories, including Empty ones.

换句话说,/S 将复制子目录 except 为空的。 /E 将复制子目录包括空目录。

【讨论】:

  • 是的,有一个错误,我颠倒了/S/E的解释。但是问题(虽然更容易理解)是:/E 暗示/S,为什么两者都有?这有点令人困惑......
  • @Liviu 您只需选择一个:/E/S,具体取决于您是否要复制空子目录。
【解决方案2】:

我在使用 /MIR 开关时也遇到了同样的情况,但没有它,这两个开关不会自动添加。所以我认为这种情况可能与其他使用过的开关有关。

带有 /MIR 开关的 Robocopy:

C:\Windows\system32>ROBOCOPY F:\robocopytestv G:\robocopytestw /MIR

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------

  Started : Friday, February 8, 2019 19:40:01
   Source : F:\robocopytestv\
     Dest : G:\robocopytestw\

    Files : *.*

  Options : *.* /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /R:1000000 /W:30

------------------------------------------------------------------------------

                           6    F:\robocopytestv\
100%        New File                   0        New Bitmap Image.bmp
100%        New File              495616        New Microsoft Access Database.accdb
100%        New File                6171        New Microsoft Excel Worksheet.xlsx
100%        New File                   0        New Microsoft PowerPoint Presentation.pptx
100%        New File                   0        New Microsoft Word Document.docx
100%        New File                7942        New OpenDocument Drawing.odg
          New Dir          0    F:\robocopytestv\New folder\

------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         2         1         1         0         0         0
   Files :         6         6         0         0         0         0
   Bytes :   497.7 k   497.7 k         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00


   Speed :            72818428 Bytes/sec.
   Speed :            4166.703 MegaBytes/min.
   Ended : Friday, February 8, 2019 19:40:01

不带 /MIR 开关的 Robocopy:

C:\Windows\system32>ROBOCOPY F:\robocopytestv G:\robocopytestw

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------

  Started : Friday, February 8, 2019 19:38:12
   Source : F:\robocopytestv\
     Dest : G:\robocopytestw\

    Files : *.*

  Options : *.* /DCOPY:DA /COPY:DAT /R:1000000 /W:30

------------------------------------------------------------------------------

                           6    F:\robocopytestv\
100%        New File                   0        New Bitmap Image.bmp
100%        New File              495616        New Microsoft Access Database.accdb
100%        New File                6171        New Microsoft Excel Worksheet.xlsx
100%        New File                   0        New Microsoft PowerPoint Presentation.pptx
100%        New File                   0        New Microsoft Word Document.docx
100%        New File                7942        New OpenDocument Drawing.odg

------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         1         0         1         0         0         0
   Files :         6         6         0         0         0         0
   Bytes :   497.7 k   497.7 k         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00


   Speed :            84954833 Bytes/sec.
   Speed :            4861.154 MegaBytes/min.
   Ended : Friday, February 8, 2019 19:38:12

带有 /MIR 和 /S 开关的 Robocopy:

C:\Windows\system32>ROBOCOPY F:\robocopytestv G:\robocopytestw /S /MIR

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------

  Started : Friday, February 8, 2019 19:41:17
   Source : F:\robocopytestv\
     Dest : G:\robocopytestw\

    Files : *.*

  Options : *.* /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /R:1000000 /W:30

------------------------------------------------------------------------------

                           6    F:\robocopytestv\
100%        New File                   0        New Bitmap Image.bmp
100%        New File              495616        New Microsoft Access Database.accdb
100%        New File                6171        New Microsoft Excel Worksheet.xlsx
100%        New File                   0        New Microsoft PowerPoint Presentation.pptx
100%        New File                   0        New Microsoft Word Document.docx
100%        New File                7942        New OpenDocument Drawing.odg
          New Dir          0    F:\robocopytestv\New folder\

------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         2         1         1         0         0         0
   Files :         6         6         0         0         0         0
   Bytes :   497.7 k   497.7 k         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00


   Speed :            12432414 Bytes/sec.
   Speed :             711.388 MegaBytes/min.
   Ended : Friday, February 8, 2019 19:41:18

带有 /MIR 和 /E 开关的 Robocopy:

C:\Windows\system32>ROBOCOPY F:\robocopytestv G:\robocopytestw /E /MIR

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------

  Started : Friday, February 8, 2019 19:42:35
   Source : F:\robocopytestv\
     Dest : G:\robocopytestw\

    Files : *.*

  Options : *.* /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /R:1000000 /W:30

------------------------------------------------------------------------------

                           6    F:\robocopytestv\
100%        New File                   0        New Bitmap Image.bmp
100%        New File              495616        New Microsoft Access Database.accdb
100%        New File                6171        New Microsoft Excel Worksheet.xlsx
100%        New File                   0        New Microsoft PowerPoint Presentation.pptx
100%        New File                   0        New Microsoft Word Document.docx
100%        New File                7942        New OpenDocument Drawing.odg
          New Dir          0    F:\robocopytestv\New folder\

------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         2         1         1         0         0         0
   Files :         6         6         0         0         0         0
   Bytes :   497.7 k   497.7 k         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00


   Speed :            72818428 Bytes/sec.
   Speed :            4166.703 MegaBytes/min.
   Ended : Friday, February 8, 2019 19:42:35

【讨论】:

  • documentation 声明 /MIR/E + /purge,因此将添加 /S,所以这里没有什么新内容(与最初的问题一致),但谢谢无论如何!
猜你喜欢
  • 1970-01-01
  • 2014-01-25
  • 2022-11-21
  • 1970-01-01
  • 2019-07-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-02
相关资源
最近更新 更多