Search code examples
coldfusionrailocfdirectory

Move a directory in ColdFusion and Railo


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?


Solution

  • 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.