Thanks for your help Pascal. Forgive me for not knowing, but can I ask you why I should use the alias instead of the variable ?
TIA, Donna On Wed, 17 Nov 2004 19:59:34 +0100, Pascal Peters <[EMAIL PROTECTED]> wrote: > I hardly think this will work correctly. Dumping filenames should give > you the string "ValueList(qGetFilenames.lanesid)". You would need an > evaluate to make it work. A better solution is using an alias (see my > other post). > > Pascal > > > > > -----Original Message----- > > From: Donna French [mailto:[EMAIL PROTECTED] > > Sent: 17 November 2004 19:49 > > To: CF-Talk > > Subject: Re: Help! Error on ValueList SOLVED > > > > Got it working with the following 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> > > > > > > Thank you to everyone that helped!!! > > > > ~ Donna > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:184644 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

