XCOPY /排除目录语法

Oni*_*ght 4 command-line xcopy exclude

我试图用来XCOPY复制一个看起来像这样的目录:

-MainFolder
 -ManyFoldersIWantToCopy
 -ManyFoldersIWantToCopy
 -...
 -Source Code
Run Code Online (Sandbox Code Playgroud)

我想使用该/EXCLUDE选项复制除Source Code.

我尝试使用以下方法,但我没有任何运气:

xcopy "Source" "Destination" /EXCLUDE:"\Source Code\" /E /C /R /I /K /Y

我收到的错误消息说:Can't read file: "\Source Code\"

我试过一起删除双引号,使用单引号代替,带/不带\,但我收到相同的错误消息。

有任何想法吗?

Hug*_*len 6

C:\>xcopy /?
...
  /EXCLUDE:file1[+file2][+file3]...
           Specifies a list of files containing strings.  Each string
           should be in a separate line in the files.  When any of the
           strings match any part of the absolute path of the file to be
           copied, that file will be excluded from being copied.  For
           example, specifying a string like \obj\ or .obj will exclude
           all files underneath the directory obj or all files with the
           .obj extension respectively.
Run Code Online (Sandbox Code Playgroud)

您需要将“源代码”放在一个文件中并在命令行上指定该文件。