Your logic is probably wrong. What does #fileNames# contain??? Just an image name, a relative path, ...? Also, it's not a very good idea to test your code on a live server.
Pascal > -----Original Message----- > From: Donna French [mailto:[EMAIL PROTECTED] > Sent: 17 November 2004 22:14 > To: CF-Talk > Subject: Re: Help! Error on ValueList SOLVED > > Okay, that deleted all files in each directory so I'm having the > hosting company restore from backup. > > Any ideas? > > Code used: > > <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 = FALSE /> > > <!--- /CONFIGURATION ---> > > > <!--- Get all of the filenames ---> > <cfquery datasource="#dsn#" name="qGetFilenames"> > SELECT #imageColumnName# AS mycol FROM products > UNION > SELECT #imageColumnName# AS mycol FROM dolls > </cfquery> > > <!--- Turn the filenames into a list ---> > <cfset fileNames = ValueList(qGetFilenames.mycol) /> > > <!--- > 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 qDirectory.type IS "file" AND 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> > > > > On Wed, 17 Nov 2004 20:47:41 +0100, Pascal Peters <[EMAIL PROTECTED]> wrote: > > There is also a directory . > > > > See my previous post for the solution > > > > > > > > Pascal > > > > > -----Original Message----- > > > From: Donna French [mailto:[EMAIL PROTECTED] > > > Sent: 17 November 2004 20:41 > > > To: CF-Talk > > > Subject: Re: Help! Error on ValueList SOLVED > > > > > > Tried starting the CFOUTPUT at startrow 2 but then I have to specify a > > > query - so I'm not sure how to work around this??? > > > > > > It seems like a CFIF should work to check for ".." but everything I've > > > tried throws an error. > > > > > > ~ D > > > > > > > > > On Wed, 17 Nov 2004 13:36:03 -0600, Donna French <[EMAIL PROTECTED]> > > > wrote: > > > > Okay, thank you for your help. I have altered the code to include > > the > > > > alias. Just looking at it without knowing it looked like an > > > > unnecessary extra step. > > > > > > > > Now I have the following error and I'm not sure how to go about > > fixing > > > > it. I want to have it skip the .. directory listing on the server, > > but > > > > can't figure out how after several attempts. Please bare with me, > > I've > > > > ordered CF books and plan to put them to good use! > > > > > > > > Here's the code and error: > > > > > > > > <!--- > > > > > > > > > > > > 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> > > > > <cfif #qDirectory.name# IS ".."> > > > > <cfelse> > > > > <cffile action="delete" > > > > file="#imagesDirectory#\#i#\#qDirectory.name#.jpg"> > > > > </cfif> > > > > > > > > > > > > <cfelse> > > > > Test Mode: #imagesDirectory#\#i#\#qDirectory.name# would be > > > > deleted. <br /> > > > > </cfif> > > > > </cfif> > > > > </cfloop> > > > > </cfoutput> > > > > </cfloop> > > > > > > > > > > > > Error processing CFFILE > > > > > > > > The path, 'c:\inetpub\lanescollectibles\images\400\..jpg', is > > illegal. > > > > Path specifications cannot include '..' > > > > > > > > The error occurred while processing an element with a general > > > > identifier of (CFFILE), occupying document position (48:11) to > > > > (48:85). > > > > > > > > Thank you! > > > > ~ D > > > > > > > > > > > > > > > > > > > > On Wed, 17 Nov 2004 20:25:49 +0100, Pascal Peters <[EMAIL PROTECTED]> > > > wrote: > > > > > You have a dynamically named column that you can't use with the > > > function > > > > > ValueList(). This leaves two options: > > > > > > > > > > Option 1 (use an alias to get a fixed column name): > > > > > <cfquery datasource="#dsn#" name="qGetFilenames"> > > > > > SELECT #imageColumnName# AS mycol FROM products > > > > > UNION > > > > > SELECT #imageColumnName# AS mycol FROM dolls > > > > > </cfquery> > > > > > <cfset fileNames = ValueList(qGetFilenames.mycol)> > > > > > > > > > > Option 2 (use evaluate): > > > > > <cfquery datasource="#dsn#" name="qGetFilenames"> > > > > > SELECT #imageColumnName# FROM products > > > > > UNION > > > > > SELECT #imageColumnName# FROM dolls > > > > > </cfquery> > > > > > <cfset fileNames = > > > > > Evaluate("ValueList(qGetFilenames.#imageColumnName#")> > > > > > > > > > > Evaluate is not a very performant function and should only be used > > if > > > > > there is no other option (and there usually is another option) > > > > > > > > > > > > > > > > > > > > Pascal > > > > > > > > > > > -----Original Message----- > > > > > > From: Donna French [mailto:[EMAIL PROTECTED] > > > > > > Sent: 17 November 2004 20:15 > > > > > > To: CF-Talk > > > > > > Subject: Re: Help! Error on ValueList SOLVED > > > > > > > > > > > > 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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:184667 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

