Trying to get parentdevdir name of Reference attachments attached with relative path

Hi all,

I'm working on a macro where I want to be able to modify the attachname of certain reference attachments. Our configuration is set to bring in attachments using save relative path but my code needs to be able to determine what the value of parentdevdir for each of my reference attachments is but I am unsure how I can do this. Can anyone suggest how I can achieve this?