Post 构建脚本以将所有文件从不同目录复制到输出目录

Post build script to copy all the files from different to output directory

我想使用 post 构建命令将项目目录中不同文件夹中的多个文件复制到输出目录。有没有一种方法可以使用 post 构建命令将这些不同文件夹中的所有文件复制到我的 bin\debug 文件夹中。我将 xcopy 与开关 /s 一起使用。但是没有用

Folder1
 File1
 File2
Folder2
 File3
 File4
FOlder3
 File5
 File6

Output
..\bin\debg
   File1
   File2
   File3
   File4
   File5
   File6

参考这个命令来实现你的要求:

xcopy /Y /I /E "$(ProjectDir)ParentFolder\*.*" "$(TargetDir)ParentFolder" 

更新:

将文件复制到单个文件夹(简单代码):

if not exist "$(TargetDir)LibTest" mkdir $(TargetDir)LibTest 
pushd $(ProjectDir)LibTest
   for /r %%a in (*.*) do (
     copy "%%a" "$(TargetDir)LibTest"
   )
   popd