Your question sounds like you want the first 10 files from every subfolder? This ought to do it (not exhaustively tested!):
xcopy /Y %1 %2 /T /E
dir %1 /b /s /A:D >tempfolderlist.txt
for /f "tokens=1 delims=¬" %%a in (./tempfolderlist.txt) do (
dir "%%a" /b /A:-D >tempfilelist.txt
for /f "tokens=1 delims=¬" %%b in (./tempfilelist.txt) do (
IF !counter! LSS 10 call :docopy %1 "%%a\%%b" %2
set /a counter+=1
del /q tempfolderlist.txt
del /q tempfilelist.txt
copy "%sourceFile%" "%targetPath%\%sourceNoDrive%" >> out.txt
If it's saved to a batch file named 'first10.cmd', you can use it like this:
first10.cmd "C:\Temp\SourcePath" "C:\Temp\DestPath"
First it prepares the destintation folder structure using xcopy, just as in your question. Then we save a list of all folders to a file, and loop over each one. For each folder, we save a list of all files in that folder, and loop over each file. For each file,
:docopy builds the copy command and executes it.