Copy files (of specific extension) from a folder structure to another folder
02:30 08 Dec 2020

I am confused to how to copy a specific type of files from a folder structure to simply a folder on a Linux machine.

This is how the source folder structure is:

Folder_X
    file1.type
    file2.nottype
    - Folder_Y
        file3.type
        file4.nottype
        - Folder_P
            file5.type
            file6.nottype
            - Folder_A
                file7.type
                file8.nottype
    - Folder_Z
        file9.type
        file10.nottype

So when I do find . -iname "*.type" in Folder_X, I get the following output:

./file1.type
./Folder_Y/file3.type
./Folder_Y/Folder_P/file5.type
./Folder_Y/Folder_P/Folder_A/file7.type
./Folder_Z/file9.type

I want to copy these .type extension files to another location in a single folder as this:

/some/another/location/Folder_I
file1.type
file3.type
file5.type
file7.type
file9.type
linux shell copy