Reputation: 4021
I have a bin folder containing dll files built both in debug and release:
myFirstFile.dll
myFirstFiled.dll
mySecondFile.dll
mySecondFiled.dll
...
File names are different from each other, but the rule is that the dlls built in Debug mode ends with 'd'. I can't find a way in a .bat script to copy these files to two different folders named Debug and Release so that the dlls ending with 'd' are copied in the Debug folder and all the others in the Release folder.
Upvotes: 2
Views: 408
Reputation: 125
You can use in-place variable editing to check for the filename ending, as in the following example:
setlocal enabledelayedexpansion
for %%F in (*.dll) do (
set plainname=%%~nF
if "!plainname:~-1!"=="d" (
move %%F DEBUG
) else (
move %%F RELEASE
)
)
endlocal
Upvotes: 2
Reputation: 75458
mkdir Debug
mkdir Release
for %a in (*.dll) do if exist %~nad.dll move %~nad.dll Debug
move *.dll Release
Upvotes: 2