SiobhanElara
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:
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.FileU tils$Canno tCreateDir ectoryExce ption: The specified directory /var/www/vhosts/cadetestin g.com/skip .cadetesti ng.com/blo op could not be created. at coldfusion.tagext.io.FileU tils.creat eDirectory (FileUtils .java:150) at coldfusion.tagext.io.Direc toryTag.do StartTag(D irectoryTa g.java:330 ) at coldfusion.runtime.CfJspPa ge._emptyT cfTag(CfJs pPage.java :2795) at cftest2dcreate2ddirectory2 ecfm139564 7809.runPa ge(/var/ww w/vhosts/c adetesting .com/skip. cadetestin g.com/test -create-di rectory.cf m:1) at coldfusion.runtime.CfJspPa ge.invoke( CfJspPage. java:244) at coldfusion.tagext.lang.Inc ludeTag.do StartTag(I ncludeTag. java:446) at coldfusion.filter.Cfinclud eFilter.in voke(Cfinc ludeFilter .java:65) at coldfusion.filter.IpFilter .invoke(Ip Filter.jav a:64) at coldfusion.filter.Applicat ionFilter. invoke(App licationFi lter.java: 430) at coldfusion.filter.RequestM onitorFilt er.invoke( RequestMon itorFilter .java:48) at coldfusion.filter.Monitori ngFilter.i nvoke(Moni toringFilt er.java:40 ) at coldfusion.filter.PathFilt er.invoke( PathFilter .java:112) at coldfusion.filter.Exceptio nFilter.in voke(Excep tionFilter .java:94) at coldfusion.filter.ClientSc opePersist enceFilter .invoke(Cl ientScopeP ersistence Filter.jav a:28) at coldfusion.filter.BrowserF ilter.invo ke(Browser Filter.jav a:38) at coldfusion.filter.NoCacheF ilter.invo ke(NoCache Filter.jav a:58) at coldfusion.filter.GlobalsF ilter.invo ke(Globals Filter.jav a:38) at coldfusion.filter.Datasour ceFilter.i nvoke(Data sourceFilt er.java:22 ) at coldfusion.filter.CachingF ilter.invo ke(Caching Filter.jav a:62) at coldfusion.CfmServlet.serv ice(CfmSer vlet.java: 219) at coldfusion.bootstrap.Boots trapServle t.service( BootstrapS ervlet.jav a:89) at org.apache.catalina.core.A pplication FilterChai n.internal DoFilter(A pplication FilterChai n.java:303 ) at org.apache.catalina.core.A pplication FilterChai n.doFilter (Applicati onFilterCh ain.java:2 08) at coldfusion.monitor.event.M onitoringS ervletFilt er.doFilte r(Monitori ngServletF ilter.java :42) at coldfusion.bootstrap.Boots trapFilter .doFilter( BootstrapF ilter.java :46) at org.apache.catalina.core.A pplication FilterChai n.internal DoFilter(A pplication FilterChai n.java:241 ) at org.apache.catalina.core.A pplication FilterChai n.doFilter (Applicati onFilterCh ain.java:2 08) at org.apache.catalina.core.S tandardWra pperValve. invoke(Sta ndardWrapp erValve.ja va:218) at org.apache.catalina.core.S tandardCon textValve. invoke(Sta ndardConte xtValve.ja va:110) at org.apache.catalina.authen ticator.Au thenticato rBase.invo ke(Authent icatorBase .java:506) at org.apache.catalina.core.S tandardHos tValve.inv oke(Standa rdHostValv e.java:169 ) at org.apache.catalina.valves .ErrorRepo rtValve.in voke(Error ReportValv e.java:103 ) at org.apache.catalina.valves .AccessLog Valve.invo ke(AccessL ogValve.ja va:962) at org.apache.catalina.core.S tandardEng ineValve.i nvoke(Stan dardEngine Valve.java :116) at org.apache.catalina.connec tor.Coyote Adapter.se rvice(Coyo teAdapter. java:466) at org.apache.coyote.ajp.AjpP rocessor.p rocess(Ajp Processor. java:197) at org.apache.coyote.Abstract Protocol$A bstractCon nectionHan dler.proce ss(Abstrac tProtocol. java:637) at org.apache.tomcat.util.net .JIoEndpoi nt$SocketP rocessor.r un(JIoEndp oint.java: 316) at java.util.concurrent.Threa dPoolExecu tor.runWor ker(Thread PoolExecut or.java:11 42) at java.util.concurrent.Threa dPoolExecu tor$Worker .run(Threa dPoolExecu tor.java:6 17) at org.apache.tomcat.util.thr eads.TaskT hread$Wrap pingRunnab le.run(Tas kThread.ja va:61) at java.lang.Thread.run(Threa d.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!
<cfdirectory action="CREATE" directory="#ExpandPath('./bloop')#" mode="644">
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.FileU
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!
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##subd irectory#" >
where
<cfset formPath = Expandpath('/miscellaneous /form1099R /') />
and this works. Once again, it's on a Windows server.
where
<cfset formPath = Expandpath('/miscellaneous
and this works. Once again, it's on a Windows server.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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!