I want to extract all image names with sub folder names into a CSV file.
I have this folder structure
Desktop/Wall Arts Product Images/framed-posters/landscape/animals-and-birds/Bighorn/Bighorn.jpg
Desktop/Wall Arts Product Images/framed-posters/landscape/animals-and-birds/Lion/Lion.jpg
Desktop/Wall Arts Product Images/framed-posters/landscape/animals-and-birds/Giant-Panda/Giant-Panda.jpg
Desktop/Wall Arts Product Images/posters/landscape/Automobiles/Best-Deisgner-Jack-Daniel-Chopper/Best-Deisgner-Jack-Daniel-Chopper.jpg
Desktop/Wall Arts Product Images/posters/landscape/Automobiles/Ford-Mustang-Cars-Classic/Ford-Mustang-Cars-Classic.jpg
Desktop/Wall Arts Product Images/framed-posters/potrait/gods/Mukkunda/Mukkunda.jpg
and many more.
I run this command but it gives only folder name posters and framed-posters
'ls' | sed -e 's/^/"/' -e 's/$/"/' > files.csv
The desired output is like -->
Image name,category,subcategory,type
Bighorn,landscape,animals and birds,framed-posters
Lion,landscape,animals and birds,framed-posters
Giant-Panda,landscape,animals and birds,framed-posters
Best-Deisgner-Jack-Daniel-Chopper,landscape,Automobiles,posters
Ford-Mustang-Cars-Classic,landscape,Automobiles,posters
Mukkunda,potrait,gods,framed-posters
How can I get the desired output in CSV file format?