Well, it ALMOST worked - when I tried it in REAL mode I get the following error:
Error processing CFFILE Unable to delete the file 'c:\inetpub\lanescollectibles\images\400\..' Access is denied. (error 5) The error occurred while processing an element with a general identifier of (CFFILE), occupying document position (46:9) to (46:79). I'm assuming it's the .. to go up a folder on the server that it's trying to delete. Guess I need to plug in a CFIF to skip that? TIA, Donna On Wed, 17 Nov 2004 12:36:53 -0600, Donna French <[EMAIL PROTECTED]> wrote: > I had left the CFAbort from yesterday. Removed that, then the query > name was wrong in part of the output. So I've corrected that and have > the current code and error: > > Code: > <html> > <head> > <title>Images Cleanup</title> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> > </head> > > <body> > <!--- CONFIGURATION ---> > > <!--- Change these to suit your server ---> > <cfset dsn = "mydsn"> > <cfset imagesDirectory = "c:\inetpub\lanescollectibles\images"> > > > <cfset imagesSubdirectories = "400,200,85"> > <!--- SQL Server is not case-sensitive, so lanesid = lanesID ---> > <cfset imageColumnName = "lanesid"> > <!--- Change this to FALSE to really do the deletes... ---> > <cfset testMode = true /> > > <!--- /CONFIGURATION ---> > > <!--- Get all of the filenames ---> > <cfquery datasource="#dsn#" name="qGetFilenames"> > SELECT #imageColumnName# FROM products > UNION > SELECT #imageColumnName# FROM dolls > </cfquery> > > <!--- Turn the filenames into a list ---> > <cfset fileNames = #ValueList(qGetFilenames.imageColumnName)# /> > > > > <!--- > Loop through the various image subdirectories doing cleanup > ---> > <cfloop list="#imagesSubdirectories#" index="i"> > <cfdirectory action="list" directory="#imagesDirectory#\#i#" > name="qDirectory"> > > <!--- > Loop over the files in the directory, deleting any that isn't > in the list of existing files > ---> > <cfoutput> > <cfloop query="qDirectory"> > <cfif not listFind(fileNames, qDirectory.name)> > <cfif not testMode> > <cffile action="delete" > file="#imagesDirectory#\#i#\#qDirectory.name#"> > <cfelse> > Test Mode: #imagesDirectory#\#i#\#qDirectory.name# would be > deleted. <br /> > </cfif> > </cfif> > </cfloop> > </cfoutput> > </cfloop> > > </body> > </html> > > Error: > Error Diagnostic Information > > An error occurred while evaluating the expression: > > fileNames = #ValueList(qGetFilenames.imageColumnName)# > > Error near line 30, column 7. > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:184641 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

