Reputation: 3636
In Adobe ColdFusion (ACF), I've always used cffile action="rename" to move both files and directories. Not unreasonably, Railo doesn't think cffile applies to directories, so you need to use cfdirectory rename, and that works fine. However, that doesn't appear to work in ACF.
For example:
<cfdirectory action="RENAME" directory="C:/tmp/aaa1/aaa2/" newDirectory="C:/tmp/aaa2">
...works in Railo, but in ACF throws this:
The specified directory attribute C:/tmp/aaa1/aaa2/ cannot be renamed to newdirectory C:\tmp\aaa1\C:\tmp\aaa2.
So it seems you'd have to use cffile to move directories on ACF, and cfdirectory on Railo. Is that really the state of the art? Is there some way to get cfdirectory to move a directory on ACF?
Upvotes: 1
Views: 1523
Reputation: 1
I get a solution only with a change. On the attribute newDirectory do not write the path, only write the new folder name and ready. Try it. This was the option for me. I use coldfucion 9.0.1
Upvotes: 0
Reputation: 11
We developed an application in CF10 that used forward slashes for the file path in cfdirectory action="rename".
<cfdirectory action="rename" directory="//fileserver/folder10/test/TEST74036JJ_CW" newdirectory="//fileserver/folder10/TEST74036JJ_CW">
This code appeared to run fine in CF10.
When we moved the code to a CF8 server, we received the same error with the newdirectory path being appended on to the end of the original directory.
The specified directory attribute //fileserver/folder10/test/TEST74036JJ_CW cannot be renamed to newdirectory \\fileserver\folder10\test\fileserver\folder10\TEST74036JJ_CW
So, it does appear that CF10 can now handle forward slashes for cfdirectory action="rename".
Upvotes: 1
Reputation: 29870
It shouldn't matter, but it works if you use backslashes.
I'd class this as a bug in CF (I'm testing with CF9.0.1) as for all other file operations I am aware of, either slash works fine on CF.
Upvotes: 3