Link to home
Start Free TrialLog in
Avatar of SiobhanElara
SiobhanElaraFlag for United States of America

asked on

Why is CFDirectory telling me the directory exists when I try to create it?

I'm trying to create a directory with the following code:

<cfdirectory action="CREATE" directory="#ExpandPath('./bloop')#" mode="644">

Open in new window


I get an error that the directory could not be created and the most likely cause of this error is that the directory already exists on my file system. (It does not; I picked a purposefully silly name that would not have been used before and DirectoryExists says it doesn't.) The StackTrace is as follows:

coldfusion.tagext.io.FileUtils$CannotCreateDirectoryException: The specified directory /var/www/vhosts/cadetesting.com/skip.cadetesting.com/bloop could not be created. at coldfusion.tagext.io.FileUtils.createDirectory(FileUtils.java:150) at coldfusion.tagext.io.DirectoryTag.doStartTag(DirectoryTag.java:330) at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2795) at cftest2dcreate2ddirectory2ecfm1395647809.runPage(/var/www/vhosts/cadetesting.com/skip.cadetesting.com/test-create-directory.cfm:1) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:244) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:446) at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at coldfusion.filter.IpFilter.invoke(IpFilter.java:64) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:430) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:112) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:58) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62) at coldfusion.CfmServlet.service(CfmServlet.java:219) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:466) at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:197) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745)

It doesn't say anything about permissions being denied, and this is on a server that we have full access to, not in a sandbox. We're on a Linux server -- any idea what the trouble might be? Thanks!
Avatar of omgang
omgang
Flag of United States of America image

I seem to recall that we recently had an issue with CFDIRECTORY with regards to virtual paths, e.g. we needed to explicitly use full physical path.  This is on a Windows server, however.  Trying to dig up notes on it.  I will post back shortly.
Well, after reviewing my notes it wasn't CFDIRECTORY we were having trouble with.  We have statements like <cfdirectory action="create" directory="#formPath##subdirectory#"
where
<cfset formPath = Expandpath('/miscellaneous/form1099R/') />
and this works.  Once again, it's on a Windows server.
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SiobhanElara

ASKER

It's possible it doesn't have write permissions to one or more of the folders in that path.

That turned out to be the issue! Thanks so much.

You're welcome!