Dear all,
I have an external hard disk with lots of big files and a lot of small matlab script files .m.

I would like to grab all the files inside that harddisk that have the .m extension or the *.mat file extension (both are matlab files).

Of course this is a
-first-find the *.m files script and
-then copy the files into the hard disk.

What I do not know is how I can also keep the structure of the folders containing the *.m and *.mat files when I will copy them in my local hard disk.

As this external hard disk contains 2TB of data it is not possible to copy all the files first and then remove the unnecessary.
So I have to find and copy only the files I need but with also keeping the tree structure that the external hard disk has .

Can you help me find out an easy way to do that?