You have to give it time to process the deletion prior to deleting the
directory.
It is that there is a locking file when you attempt to delete the file. This
is
set by IIS. Thus when CF runs it runs both commands almost at the exact same
time.
Suggestion is putting a delay in between the two commands or running a loop
by checking the directory. Once it returns a recordcount of 0, then delete
the
directory.
-----Original Message-----
From: river [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 25, 2001 1:23 PM
To: CF-Talk
Subject: deleting a directory with a file in it
I am trying to delete a directory and a file using cfdirectory. I have the
following code, and it only works half the time.
<cfset SetDirectory = "D:\inetpub\wwwroot\test">
<cfset DeleteFile = SetDirectory & "\index.cfm">
<cffile action="delete" file="#DeleteFile#">
<cfdirectory action="delete" directory="#SetDirectory#">
When it gives me an error, it says that the directory is not empty. After I
get this error and look in the directory, the file is deleted. How can I
prevent this from happning, so it deletes them both every time.
Thanks for any help.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists