Search code examples
coldfusioncoldfusion-9

How can I get the parent of the current file?


To get the current *.cfm file I use:

GetFileFromPath(GetCurrentTemplatePath())

Is there a simple way to get the parent of the current file?

I.e. if the current file is ...\MyApp\Users\addUser.cfm I want to return Users.

Edit: the reason I want to do this is to check for access permission. Depending on path different policies will be enforced.

Edit: The linked question doesn't provide the correct answer.


Solution

  • GetFileFromPath(GetFileInfo(GetCurrentTemplatePath()).parent)
    

    This will return exactly what I need. Using the example from the question: just Users withouth the full path.