Quick Directory Programming Question

Discussion in 'Programming' started by twalters84, Dec 17, 2007.

  1. #1
    Hey there,

    I have some coldfusion code on a Windows server.

    However, I am going to express this in more general terms to open it up to other languages.

    
    
    The code below:
    
    <cfset myPath = '#ExpandPath("..\coder_photos\")#'>
    
    produces the following output:
    
    D:\Inetpub\someSiteName\coder_photos\ 
    
    Likewise, the code below:
    
    <cfset myPath = '#ExpandPath("..\coder_photos")#'>
    
    produces the following output:
    
    D:\Inetpub\someSiteName\coder_photos
    
    Note the difference is the slash "\" at the end.
    
    When I try to delete a file using the following code:
    
    <cffile action = "delete" file = "#myPath#\thumbnails\#myImage#">
    
    
    Code (markup):
    This works successfully no matter if there is an extra slash between the path and thumbnails directory. However, why is this?

    If I type "C:\Documents and Settings\\Username" into my browser with Username being an account on my computer, it doesnt work and I am running Windows. Why would it work on the server?

    Im just curious so if anybody knows, please share :)

    Thanks.

    Sincerely,
    Travis Walters
     
    twalters84, Dec 17, 2007 IP