In your case, you probably want to delete files only <cfif qDiroctory.type IS "file" AND NOT listFind(fileNames, qDirectory.name)> <cffile action="delete" file="#imagesDirectory#\#i#\#qDirectory.name#"> ...
You don't want to delete directories and there was an extra .jpg in your CFFILE Pascal > -----Original Message----- > From: Donna French [mailto:[EMAIL PROTECTED] > Sent: 17 November 2004 20:36 > To: CF-Talk > Subject: Re: Help! Error on ValueList SOLVED > > 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:184652 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

