Copy files of certain type in directory and subdirectories preserving structure

Simply put, my question is the same as this but for Windows 7 Ultimate 64-bit.

Note that I want to copy only files of a specific file type, and that I must preserve the directory structure and names. In other words, I want to do the same as copying a folder and its subfolders (e.g. I want to copy foo/myfolder to moo/myfolder), but leave out all the files except those of a specific file type (e.g. .txt files).

Hope my question is clear enough, and that this is possible!


Solution 1:

xcopy /s foo\myfolder\*.txt moo\myfolder