Discussion:
Cfdirectory error... Help please!!!
(too old to reply)
fareed100
2009-02-24 06:12:54 UTC
Permalink
I am trying to get a code to create a folder (ecgtemp) that is then renamed to
another name (#title#) based on a variable (title): Here is the error I am
getting:

The specified directory attribute
C:/ColdFusion8/wwwroot/ecardia/Images/ECG/ecgtemp cannot be renamed to
newdirectory C:\ColdFusion8\wwwroot\ecardia\Images\ECG\ECG Feb 23.
The exception occurred during a cfdirectory action="rename".


<cfquery name="Recordset1" datasource="ecardia">
SELECT *
FROM ecgquiz
ORDER BY ecgquiz.ecgid desc
</cfquery><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ECG-quiz-creator</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">

<!--
body {
background-image: url();
}
.style2 {
color: #FFFF00;
font-weight: bold;
font-size: large;
}
.style4 {
font-size: large;
font-weight: bold;
}
.style47 {color: #000000}
.style59 {color: #000000; font-weight: bold; }
body,td,th {
font-family: Geneva, Arial, Helvetica, sans-serif;
}
.style60 {
font-size: small;
font-weight: bold;
}
.style62 {color: #FFFFFF; font-weight: bold; font-size: small; }
.style64 {color: #000000; font-weight: bold; font-size: small; }
.style65 {font-size: small}
.style68 { color: #000000;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
font-size: small;
}
-->
</style>
<link href="CCS.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="100%" border="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF"
id="cross bar">
<!--DWLayoutTable-->
<tr align="center" valign="middle" bgcolor="#0066FF" class="style68">
<td width="10%"><a href="Master-admin.cfm"
class="style59">master-admin</a></td>
<td width="8%" height="23"><span class="style62"><a href="index.cfm"
class="style59">home</a></span></td>
<td width="10%"><span class="style64"><a href="login.cfm"
class="style59">log in</a> </span></td>
<td width="11%"><span class="style60"><a href="ECG-index.cfm"
class="style59">ECG quiz</a> </span></td>
<td width="17%"><span class="style60"><a href="EP-index.cfm"
class="style59">arrhythmia quiz</a> </span></td>
<td width="10%"><a href="sharecase.cfm" class="style59">case
sharing</a></td>
<td width="13%"><a href="literature.cfm" class="style59">recent
literature</a></td>
<td width="7%"><span class="style62"><a href="links.cfm"
class="style59">links</a></span></td>
<td width="14%"><span class="style65"><strong><a href="about.cfm"
class="style59">about e-cardia</a></strong></span></td>
</tr>
</table>
<cfif isdefined("submit1")>
<!---<cffile action="upload"
destination="/c:/Websites/3fgc3w/ecardia/Images/ECG/" filefield="E1"
nameconflict="makeunique">--->
<cffile action="upload"
destination="C:/ColdFusion8/wwwroot/ecardia/Images/ECG/ecgtemp" filefield="E1"
nameconflict="makeunique">

<!---Fathi: for the publsihed verions use the following path: <cffile
action="upload" destination="/c:/websites/3fgc3w/ecardia/Images/ECG/ecgtemp"
filefield="E1" nameconflict="makeunique">--->

<cfelseif isdefined("submit2")>
<!---<cfquery name="quizset" datasource="ecardia">
Update ecgquiz set active=0
</cfquery>--->
<cfquery name="getecgcolor" datasource="ecardia">
SELECT ecgcolor from colors where choice= '#level#'
</cfquery>

<cfquery name="quizset2" datasource="ecardia" >
INSERT INTO ecgquiz([title], [hx], [Q], [a], [i1], [pending], [level],
[ecgcolor], [posted])
VALUES ('#title#', '#history#', '#question#','#answer#', '#uploadedfile#',
yes, '#level#', '#getecgcolor.ecgcolor#', '#dateFormat(now())#')
</cfquery>
<cfdirectory directory="C:/ColdFusion8/wwwroot/ecardia/Images/ECG/ecgtemp"
action="rename" newdirectory="#title#" >



<!---Fathi: this is the code that is for the published version: <cfdirectory
directory="C:/Websites/3fgc3w/ecardia/Images/ECG/ecgtemp" action="rename"
newdirectory="#title#" >--->


<!---The above code will change the name of the temporary directory "ecgtemp"
to a new name that is based on the title of the ECG quiz that is the same as
the "text field" --->

<cflocation url="ECG-admin.cfm">

<!--- Fathi: in this case I struggled to make the query work, if I take the
textfield value "level" out it will work, however, when it is there it does not
work and gives an error. Eventually when I used the brackets [ ] for all the
items it worked. Apparently there some names, one of them is "level" , that are
reserved for the program so you cannot use them as a value or varialbe unless
you specify that to the program by putting the brackets. A similar problem
happend in the file called: literature-admin where names like: source, ...etc
where not accepted unless bracketed. --->


</cfif>
<div align="center">
<table width="99%" border="2" bordercolor="#000000" id="ECG admin">
<tr>
<th align="left" valign="top" bgcolor="#000000" scope="col"><p
align="center" class="style2">eCardia administration </p> </th>
</tr>
<tr>
<th height="892" align="left" valign="top"
background="/ecardia/Images/other-pages/bg_T_12Y.gif" bgcolor="#FFFFFF"
scope="col"><div align="center">
<p class="style4">ECG Quiz Creator </p>
<form action="" method="post" name="form1">

<div>
<div align="center">
<cfif isdefined("Submit1")>
<cfoutput><img src="images/ecg/ecgtemp/#cffile.serverfile#">
<input type="hidden" name="uploadedfile"
value="#cffile.serverfile#">
</cfoutput>
</cfif>
</div>
</div>
<p align="center"><strong>Title:</strong>
<input name="title" type="text" id="title" value="">
</p>
<p align="center"><strong>level:</strong>
<select name="level" id="level">
<option>Green</option>
<option > Orange</option>
<option >Red</option>
</select>
<!-- Fathi: Here is we added a menu form and it was
named:"level". The actual values (i.e., green, orange, red) will be labelled
"#level#". -->
</p>
<p align="center"><strong>History:</strong></p>
<p align="center">
<textarea name="history" cols="110" rows="6" wrap="PHYSICAL"
id="history"></textarea>
</p>
<p align="center"><strong>Question:</strong></p>
<p align="center">
<textarea name="question" cols="110" rows="6" wrap="PHYSICAL"
id="question"></textarea>
</p>
<p align="center"><strong>Answer:</strong></p>
<p align="center">
<textarea name="answer" cols="110" rows="16" wrap="PHYSICAL"
id="textarea"></textarea>
</p>
<p align="center">
<input type="submit" name="Submit2" value="Submit" >

</p>
</form>
<p class="style4">&nbsp;</p>
</div></th>
</tr></table>
</div>
</body>
</html>
Daverms
2009-02-24 06:23:51 UTC
Permalink
Hi,

Use the DirectoryExists function and make sure the source directory exists before renaming it.

HTH
fareed100
2009-02-25 05:19:07 UTC
Permalink
Thanks Daverms. The source direcotry exists "ecgtemp". However, still getting the error. Any other ideas??
Thanks
Fareed
GArlington
2009-02-25 12:12:16 UTC
Permalink
Post by fareed100
Thanks Daverms. The source direcotry exists "ecgtemp". However, still getting the error. Any other ideas??
Thanks
Fareed
What is further wording of the error message, is there anything about
"locked" dir or something similar?
cjdunkerley
2009-02-28 13:48:42 UTC
Permalink
Hi Fareed,

ECG Feb 23.

Have you got spaces in the file/folder name? Perhaps that is causing some problems.

You could do a replace(filename, " ", "_") or something similar.

Chris.
Adam Cameron
2009-02-28 15:46:15 UTC
Permalink
Post by fareed100
I am trying to get a code to create a folder (ecgtemp) that is then renamed to
another name (#title#) based on a variable (title): Here is the error I am
The specified directory attribute
C:/ColdFusion8/wwwroot/ecardia/Images/ECG/ecgtemp cannot be renamed to
newdirectory C:\ColdFusion8\wwwroot\ecardia\Images\ECG\ECG Feb 23.
The exception occurred during a cfdirectory action="rename".
This could be caused by having a file within the directory you're renaming
being locked (like because it's being written to, or just open or
something).

And can you do us a favour? It's good you posted the code that's giving
you the problem, but can you pls be a bit judicious as to what code to
post? For example you've posted dozens and dozens of lines of code that's
just CSS or HTML, which couldn't *possibly* be related to your issue. And
there's dozens and dozens more lines of just comments. There's no point in
posting that stuff. There's actually only a couple of lines in there that
contributes to your problem in the slightest. Those are the only ones we
need to see.

I initially ignored your post because I refuse to wade through all that
unnecessary fluff to try to work out which bit of code might be causing the
problem.
--
Adam
fareed100
2009-03-01 05:46:59 UTC
Permalink
Chris,

Thank you very much for taking the time and looking at my posting and for your
suggestion.

I tried the name also without spaces but unfortunately did not work. Any other
suggestions?

Fareed
fareed100
2009-03-01 05:52:58 UTC
Permalink
Adam,

Your point regarding the code, although unfriendly stated, is well taken.
Having said that, there are some members who kindly looked at my posting and
knew what to pick up and work with.

Anyways, thanks for your suggestions. There was no file in the directory being
renamed that is locked or being written to or used by other program..etc.

Any other ideas?

thanks
Fareed
fareed100
2009-03-01 05:55:39 UTC
Permalink
Problem re-posted ( code cleaned):

I am trying to get a code to create a folder (ecgtemp) that is then renamed to
another name (#title#) based on a variable (title): Here is the error I am
getting:

The specified directory attribute
C:/ColdFusion8/wwwroot/ecardia/Images/ECG/ecgtemp cannot be renamed to
newdirectory C:\ColdFusion8\wwwroot\ecardia\Images\ECG\ECG Feb 23.
The exception occurred during a cfdirectory action="rename".

Attach Code

<cfif isdefined("submit1")>

<cffile action="upload"
destination="C:\ColdFusion8\wwwroot\ecardia\Images\ECG\ecgtemp" filefield="E1"
nameconflict="makeunique">

<cfelseif isdefined("submit2")>

<cfquery name="getecgcolor" datasource="ecardia">
SELECT ecgcolor from colors where choice= '#level#'
</cfquery>

<cfquery name="quizset2" datasource="ecardia" >
INSERT INTO ecgquiz([title], [hx], [Q], [a], [i1], [pending], [level],
[ecgcolor], [posted])
VALUES ('#title#', '#history#', '#question#','#answer#', '#uploadedfile#',
yes, '#level#', '#getecgcolor.ecgcolor#', '#dateFormat(now())#')
</cfquery>

<cfdirectory directory="C:\ColdFusion8\wwwroot\ecardia\Images\ECG\ecgtemp"
action="rename" newdirectory="#title#" >

<cflocation url="ECG-admin.cfm">

</cfif>

Loading...