How to detect the folder used for vendor logo

Whenever I upload a logo for vendor, it stores it in logos/X folder. I see it is different each time. Sometimes it is stored in logos/8 folder, sometimes it is stored in logos/29/, sometimes in logos/40/ folder. How can I detect the folder in php code inside my addon?

Please have a look