How can I get the parent of the current file?

淺唱寂寞╮ 提交于 2019-12-23 18:00:33

问题


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.


回答1:


GetFileFromPath(GetFileInfo(GetCurrentTemplatePath()).parent)

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



来源:https://stackoverflow.com/questions/31539348/how-can-i-get-the-parent-of-the-current-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!