Why not use the function FileExists(absolute_path) -----Original Message----- From: phumes1 [mailto:[EMAIL PROTECTED]] Sent: dinsdag 4 juni 2002 16:19 To: CF-Talk Subject: Check for file existence
I need to check if a file exists on the server and if so, run some code. Whats the best way to check if the file "test.txt" exists in a directory The below doesn't seem to work. Note that the filename can change but the file extension (.txt) will stat the same. <cfset FileName = ListLast(url.filename, "\")> <cfset DirPath = Left(url.filename, Evaluate(Len(url.filename) - len(FileName) - 1))> <cfset TheFile = ListLast(url.filename)> <cfset TheFolder = DirPath> <cfparam name="dir" default="#TheFolder#"> <cfdirectory action="LIST" directory="#dir#" name="FileCheck"> <cfoutput query="FileCheck"> <cfif FileCheck.name IS "test.txt"> <h3>Found Match</h3> <cfelse> <h3>No Match</h3> </cfif> </cfoutput> +----------------------------------------------------------------------- ------------+ Philip Humeniuk [EMAIL PROTECTED] [EMAIL PROTECTED] +----------------------------------------------------------------------- -------------+ ______________________________________________________________________ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

