Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if I can connect to Directory?

Status
Not open for further replies.

dreampolice

Technical User
Dec 20, 2006
85
US
I can list files from a directory using MX 7 on Windows Servers but was wondering if there is a way to make sure the connection is working to the Directory which is located on another Windows Server.

There has been occasions when the network was down and I could not connect to the directory and I would like to have a condition where I can advise users such as "Cant connect to....".

Please advise:

Code:
<cfset theDir = "C:\thePathToDirectoryOnAnotherWindowsServer">
<cfif ????I can connect to #theDir#>
<CFDIRECTORY action="LIST" directory="C:\thePathToMyDirectoryHere" name="myInfo">
<CFOUTPUT query="myInfo">
  <!--- directory info here --->
</CFOUTPUT>
<cfelse>
    Cant connect to #theDir#
</cfif>
 
would this work?
Code:
<cfset theDir = "C:\thePathToDirectoryOnAnotherWindowsServer">
<cftry>
<CFDIRECTORY action="LIST" directory="#theDir#" name="myInfo">
<CFOUTPUT query="myInfo">
  <!--- directory info here --->
</CFOUTPUT>
<cfcatch>
Can't connect to #theDir#
</cfcatch>
</cftry>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top