I have a folder structure like :-                                            Type1                                           Type 2                                                      |                                               |                    ----------------------------------------------------------------------------------------                    |                                       |                                   |                                       subType1                                 subType2                           subType1                                 |                                       |                                   |                       ----------------------------------------------------------------------------------------------------------        |                   |                   |                   |                 |                   |             typeA               typeB             typeA               typeB             typeA               typeB       -------------------------------------------------------------------------------------------------------------    |   |   |           |    |    |         |   |   |           |   |   |       |   |   |            |    |     |    F1  F2  F3          F1   F2   F3        F1  F2  F3          F1  F2  F3      F1  F2  F3           F1   F2    F3            |                     |                                     |                                       |            |                     |                                     |                                       |            \/                    \/                                    \/                                      \/    --------------------------------------------------------------------------------------------------------------    |       |      |         |       |                      |         |      |                          |       |    black  red   blue       black   red                     black     red    blue                       black  redIn each folder of color some images are there like this :-(and many more )      Type1-subType1-typeA-black-dfsdf1.JPG       Type1-subType1-typeB-black-one.JPG    Type1-subType1-typeA-red-dfsdf1.JPG         Type1-subType1-typeB-red-one.JPG    Type1-subType1-typeA-blue-dfsdf1.JPG        Type1-subType1-typeB-black-oh.JPG    Type1-subType1-typeA-black-2dsfsdf.JPG      Type1-subType1-typeB-red-oh.JPG    Type1-subType1-typeA-red-2dsfsdf.JPG    Type1-subType1-typeA-blue-2dsfsdf.JPG    Type1-subType1-typeA-black-3asdfdf3.JPG    Type1-subType1-typeA-red-3asdfdf3.JPG    Type1-subType1-typeA-blue-3asdfdf3.JPG    Type1-subType2-typeB-black-SSS.JPG      Type2-subType1-typeB-black-5.JPG    Type1-subType2-typeB-red-SSS.JPG        Type2-subType1-typeB-black-5.JPG    Type1-subType2-typeB-blue-SSS.JPG       Type2-subType1-typeB-black-565.JPG    Type1-subType2-typeB-black-AAA.JPG      Type2-subType1-typeB-black-565.JPG    Type1-subType2-typeB-red-AAA.JPG            Type1-subType2-typeB-blue-AAA.JPG   I want to read each images and save into individual csv  file. So the csv file format will be:For folder structure  Type1-subType1-typeA -dfsdf1.JPG  into file1.csv          Image name                        |colour | subcat| subtype  | Type1 |    Type1-subType1-typeA-black-dfsdf1.JPG   | black | typeA | subType1 | Type1 |     Type1-subType1-typeA-red-dfsdf1.JPG     | red   | typeA | subType1 | Type1 |     Type1-subType1-typeA-blue-dfsdf1.JPG    | blue  | typeA | subType1 | Type1 | For folder structure  Type1-subType1-typeA -2dsfsdf.jpg file2.csv          Image name                    |colour | subcat| subtype  | Type1 |Type1-subType1-typeA-black-2dsfsdf.JPG  | black | typeA | subType1 | Type1 | Type1-subType1-typeA-red-2dsfsdf.JPG    | red   | typeA | subType1 | Type1 | Type1-subType1-typeA-blue-2dsfsdf.JPG   | blue  | typeA | subType1 | Type1 And So on for other folders also.How can i get the desired out put?Note: The image name reflects the folder structure.So far, I've read all images from different folder into a single csv file.Here is my output:            Image name                  |colour | subcat| subtype  | Type1 |Type1-subType1-typeA-black-dfsdf1.JPG   | black | typeA | subType1 | Type1 | Type1-subType1-typeA-red-dfsdf1.JPG     | red   | typeA | subType1 | Type1 | Type1-subType1-typeA-blue-dfsdf1.JPG    | blue  | typeA | subType1 | Type1 | Type1-subType1-typeA-black-2dsfsdf.JPG  | black | typeA | subType1 | Type1 | Type1-subType1-typeA-red-2dsfsdf.JPG    | red   | typeA | subType1 | Type1 | Type1-subType1-typeA-blue-2dsfsdf.JPG   | blue  | typeA | subType1 | Type1 | Type1-subType1-typeA-black-3asdfdf3.JPG | black | typeA | subType1 | Type1 | Type1-subType1-typeA-red-3asdfdf3.JPG   | red   | typeA | subType1 | Type1 | Type1-subType1-typeA-blue-3asdfdf3.JPG  | blue  | typeA | subType1 | Type1 | Type1-subType2-typeB-black-SSS.JPG      | black | typeB | subType2 | Type1 | Type1-subType2-typeB-red-SSS.JPG        | red   | typeB | subType2 | Type1 | Type1-subType2-typeB-blue-SSS.JPG       | blue  | typeB | subType2 | Type1 | Type1-subType2-typeB-black-AAA.JPG      | black | typeB | subType2 | Type1 | Type1-subType2-typeB-red-AAA.JPG        | red   | typeB | subType2 | Type1 | Type1-subType2-typeB-blue-AAA.JPG       | blue  | typeB | subType2 | Type1 | Please suggest how can I achieve my desired output.
Extract file names with directory structure into CSV file (separate csv file for each image name)
shell script;ubuntu;csv;output;file format