Copy files by mask in destination in BATCH

If you want to copy some file from known location to location by mask (unknown), use next:

@echo off
setlocal enableextensions enabledelayedexpansion

set pathFrom=D:\ScriptCopyTest\my1.java
set pathTo=D:\ScriptCopyTest\Test*

set copy_opts=/I /Y /R /V /F /H

for /d %%f in (%pathTo%*) do ( xcopy %pathFrom% %%f %copy_opts% )

pause