I'm working on a project that looks for what folder a file is in before determining what function to run. Currently, I'm using var pathname = decodeURI(app.activeDocument.path.name); to extract the immediate folder that the file is located in, but in some instances I need to get the name of a folder back from that one. For example, it currently gets C:\Texture Sets\Library 1\Large Format and returns the folder "Large Format" to the pathname variable since the file I'm working with is in that folder. What I need is a way for it to check for "Library 1" in that same path using the same file. Thanks for any help!
You can use...
var parentFolder = decodeURI(app.activeDocument.parent.parent.name); alert(parentFolder);
Awesome, that seems to have done it... though I did make one small change as it was telling me something was undefined. I just changed it to
var parentFolder = decodeURI(app.activeDocument.path.parent.name);
and it seems to work now. Thanks for the help!