for /r "C:\Users\bui\Desktop\Annotation Traing Package\test1" %i in (*03.json) do copy "%i" "C:\Users\bui\Desktop\Annotation Traing Package\test2"
i want to copy all 03.json files from test1 to test2 but in test1 folder, there are subfolders, and in those subfolders also have 03.json files. With for loop i cant loop through subfolders and copy 03.json files in it, but i also want to copy those subfolders from test1 to test2 with those 03.jon files in it. is there possible way to do it?
i tried using xcopy to copy those subfolders first then use for loop but no use, bc they copy all files to "C:\Users\bui\Desktop\Annotation Traing Package\test2"
robocopy /?and read the output help. There can be usedrobocopy "%USERPROFILE%\Desktop\Annotation Traing Package\test1" "%USERPROFILE%\Desktop\Annotation Traing Package\test2" *03.json /S /NDL /NFL /NJH /NJS /R:1 /W:1 >nulto copy all*03.jsonfiles in entire directory tree oftest1totest2with replicating the directory tree.for /R "%USERPROFILE%\Desktop\Annotation Traing Package\test1" %I in (*03.json) do @for /F "tokens=6* delims=\" %J in ("%~dpI") do @md "%USERPROFILE%\Desktop\Annotation Traing Package\test2\%K" 2>nul & copy /B /Y "%I" "%USERPROFILE%\Desktop\Annotation Traing Package\test2\%K" >nulwhich is less efficient than the usage of ROBOCOPY designed for exactly such file copying tasks. BTW: The folder nameAnnotation Traing Packageshould be most likelyAnnotation Training Package.