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"
RoBoCopyis the best method to do this IMHO.The
Robocopyutility is made to copy directory trees and matching files and has been included in windows since Windows 7 released in 2009.Note I used
/Eassuming you would want the folders which are empty assuming you may have things like log folders which contain no "03.json" filesIf you do not want to create empty directories when they do not contain "03.json" files, then simply omit the
/Eoption