Coldfusion cffile delete question
Posted on 2013-05-29
I'm trying to setup some housekeeping on the images folder of my real estate listings site, by grabbing the ListID of active properties from by database table then comparing those ListID's to the photo names which are named like "ListID-1.jpg, ListID-2.jpg, etc..
but I'm getting an error
"File C:\ColdFusion9\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\A100969-1.jpg specified in action delete does not exist."
The error occurred in C:\WWW\2013Fickling\rets.cfm: line 450
448 : <cfloop query="getFiles">
449 : <cfif NOT listFindNoCase(iList,getFiles.name)>
450 : <cffile action = "delete" file = "#getFiles.Name#">
451 : </cfif>
452 : </cfloop>
when running the following code:
<!---DELETE OLD PICS--->
<cfquery name="getImages" datasource="mydata">
select ListID as imgfile from res
Order by 1
<cfset iList = valueList(getImages.imgfile)>
<cfdirectory action = "LIST" directory = "#ExpandPath('/ftp/rets/photos/')#" name="getFiles">
<cfif NOT listFindNoCase(iList,getFiles.name)>
<cffile action = "delete" file = "#getFiles.Name#">
A100969-1.jpg is a file in my photos folder that needs deleting, but for some reason the path is just wrong?
Any help appreciated!