How to find out the folder/file names in the assembly tree using macro?

I have four folders

AA

BB

CC

DD

There are different parts in those folders. I need to sort the parts in different folder in different ways.

Is there any way that I can know what part is in which folder.

Thanks

SolidworksApi macros