xcopy
supports *
wildcards and even allows you to clone whole directory structure. My project uses these Qt libraries I need to distribute:
Qt5CLucene.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Help.dll
Qt5Multimedia.dll
Qt5Network.dll
Qt5PrintSupport.dll
Qt5Sql.dll
Qt5Svg.dll
Qt5Widgets.dll
Qt5Xml.dll
Qt5XmlPatterns.dll
They are not all in the same directory in the Qt installation and the list is subject to change - especially additions. So I wanted to use wildcard /*/
to find a file anywhere in directory tree:
C:\Qt\5.3.0-64> xcopy ".\*\%NAME%.dll" "%~dp0\release"
It doesn't work, files are not being found. This is the full code:
C:
cd C:\Qt\5.3.0-64\
For %%a in (
"Qt5CLucene"
"Qt5Core"
"Qt5Gui"
"Qt5Help"
"Qt5Multimedia"
"Qt5Network"
"Qt5PrintSupport"
"Qt5Sql"
"Qt5Svg"
"Qt5Widgets"
"Qt5Xml"
"Qt5XmlPatterns"
) do (
xcopy ".\**\%%~ad.dll" "%~dp0\debug"
)
So can I somehow avoid typping full paths (eg. qtbase\bin\Qt5CLucene
) in the batch?
try like this (xcopy could ask if you want to create directory - copy is used instead):
For /r "C:\Qt\5.3.0-64\" %%a in (
"*Qt5CLucene.dll"
"*Qt5Core.dll"
"*Qt5Gui.dll"
"*Qt5Help.dll"
"*Qt5Multimedia.dll"
"*Qt5Network.dll"
"*Qt5PrintSupport.dll"
"*Qt5Sql.dll"
"*Qt5Svg.dll"
"*Qt5Widgets.dll"
"*Qt5Xml.dll"
"*Qt5XmlPatterns.dll"
) do (
copy /y "%~fa" "%~dp0\debug"
)