code_junkie

How can I recursively copy files of a specific pattern into a single flat folder on Windows?

Nov 12th, 2011
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. mkdir targetDir
  2. for /r %x in (*.dll, *pdb) do copy "%x" targetDir
  3.  
  4. @echo off
  5. if %1'==' goto usage
  6. if %2'==' goto usage
  7. if %3'==' goto usage
  8. for /D %%F in (%1*) do xcopy %%F%2 %3 /D /Y
  9. for /D %%F in (%1*.) do call TreeCopy %%F %2 %3
  10. goto end
  11. :usage
  12. @echo Usage: TreeCopy [Source folder] [Search pattern] [Destination folder]
  13. @echo Example: TreeCopy C:ProjectUDI *.xsd C:ProjectUDISOADeployMetadata
  14. :end
Add Comment
Please, Sign In to add comment