AnsweredAssumed Answered

Need to get exact folder name

Question asked by kevin33 on Apr 6, 2016
Latest reply on Apr 7, 2016 by kevin33
Hi, I am trying to create a minimal script to change the name of an uploaded file with a folder rule.
Until now I just needed folderName = document.parent.name and it worked good.
Now i would need to get the name (that of couse can change each time) of exactly three folders before the document.parent.name
I mean let's say I have a site with these folder structure.
banana \ apple \ orange \ tomato \ cherry
Before I just needed var folderName = document.parent.name that is to say in this case "cherry"
How do I get "apple" name so to set it as my var folderName ?
The name "apple" can change each time, i mean it's the user that will change this folder name and I can't know it before, but I know that in my template folder structure that folder (apple) it's the only one that can change name, all the rest is fixed, and (in this case apple) it's exactly the third folder before the folder cherry where there's the folder rule.
Thanks in advance.

Outcomes