开发者

Is there a way to copy all subdirectories matching a pattern?

I'm running a script post-build that copies binary results to a common results directory. It roughly looks like this:

...
copy /Y trunk\foo\bin\Release\* out
copy /Y trunk\bar\bin\Release\* out
copy /Y trunk\whee\bin\Release\* out
...
开发者_如何转开发

Since there are a lot of projects involved I'd like to abbreviate this script and simply copy all */bin/Release/* files. How could I do this?

(Of course I could just write a small program but I'm interested in a general solution.)


CD trunk
FOR /F "USEBACKQ tokens=*" %%A IN (`dir /b /a:d /s ^| FIND /I "\bin\release"`) DO (
 COPY /Y "%%A\*" "out"
)

change directory to trunk folder; loop over the output of dir|find, which it grabs a list of all subdirectories and only targets the ones containing \bin\release in the pathname; copy all files contained in the release folders to out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜