Skip to main content
Participant
July 2, 2020
Answered

Return root path of a directory

  • July 2, 2020
  • 2 replies
  • 323 views

Hello community

I have been researching routes in ColdFusion and I want to know if there is any function that returns the root node of the directory.

Example: C:\mydirectory\myotherdirectory  

output:   C:\         

 

Example: D:\mydirectory\myotherdirectory  

output:   D:\ 

 

 

     

 

 

    This topic has been closed for replies.
    Correct answer BeRadB

    #listfirst(expandpath('./'),'/')#

     

    this should return the 'c:' part of the current directory

     

    please note this might not work if you are in a shared environment.

     

    and not too sure this will work on Linux

     

    2 replies

    BKBK
    Community Expert
    Community Expert
    July 5, 2020

    createobject("java", "java.lang.System").getenv("SystemDrive")

    BeRadB
    BeRadBCorrect answer
    Inspiring
    July 3, 2020

    #listfirst(expandpath('./'),'/')#

     

    this should return the 'c:' part of the current directory

     

    please note this might not work if you are in a shared environment.

     

    and not too sure this will work on Linux

     

    Iambradb.com Adobe ColdFusion Specialist.