Move a directory in ColdFusion and Railo - coldfusion

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?

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.

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

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

Related

Regarding ColdFusion Mapping

I am rebuilding my directory structure. The old way had CFC folders in each sub-directory that was a nightmare. I went into ColdFusion administrator and set a mapping (which is actually outside my root). Now here is the confusing part.
My original structure looks similar to this.
\appRoot
\appRoot\cfc
\appRoot\modules
\appRoot\modules\cfc
I moved the files from the CFC directory inside of modules to the mapped location and all works great. Next I went to move the files from appRoot directory (which is one up from modules) and no matter what I do it will not find those in the mapped directory. It keeps insisting I put the files back in the CFC directory under appRoot.
So why would pages further down the directory structure see the new CFC mappings and not the pages above them?

CFDirectory is saying that it can't copy files to destination directory

We have a simple script that copies files across from a base install folder we created to house files for our application. When we choose to install a new site, based on these files, it's saying that the destination directory can't be found.
<cfset variables.destination = "#variables.base_path#\#variables.destination#\wwwroot\">
<!--- actually copying the base installation to the new location--->
<cfdirectory action="copy" directory="#mycontent.directory#\#mycontent.name#" destination="#variables.destination#" recurse="yes" >
<!--- end copying the system files --->
The wwwroot directory will always exist on the system. We are trying to push files into that folder. However it's throwing an error and won't allow it to go through.
The actual error message being caught is:
The specified directory C:\home\domainname.com\wwwroot\ could not be
created. The most likely cause of this error is that
C:\home\domainname.com\wwwroot\ already exists on your file system.
I tried the following in ColdFusion 11:
<cfdirectory directory="//users/myname/sites/test/source"
destination="//users/myname/sites/test/dest"
action="copy" recurse="yes">
This works fine, whether the folder has been previously created or not. Also, it seems that the recurse attribute is supported, despite the documentation only stating that it is valid for list and delete actions.
https://wikidocs.adobe.com/wiki/display/coldfusionen/cfdirectory
As it seems to happen some times but not others perhaps it is a timing issue or with large files / multiple folders?

Default documents in web.xml not being respected (developer/stand-alone server)

For some reason, when browsing to URL that ends in a folder (ex. //localhost:8500/website/directory/), index.cfm is not loading and instead a 404 error page is returned. I have confirmed that the ...\web-inf\web.xml file is being used by modifying filter-mappings to enable the display of .htm and .txt files. In fact, none of the files in the welcome-file-list section are being used even if they exist which leads me to believe that there is something wrong with this section of the web.xml file.
The web.xml files are as follows:
{install-root}\cfusion\runtime\conf\web.xml
{install-root}\cfusion\wwwroot\web-inf\web.xml
Both files contain the same XML listed below.
<web-app>
...
<welcome-file-list id="WelcomeFileList_1034013110672">
<welcome-file>index.cfm</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.txt</welcome-file>
</welcome-file-list>
...
</web-app>
I have just recently patched to Update 6, but I believe that the problem was always there from the initial install. Please note that this is the development stand-alone server.
Has anyone already solved this or have any ideas on how to proceed other than re-installing CF10 and using IIS?
Late to the party, IMO there are two possible reasons that i can think of for this issue
Either your have additional mapping like "/" in place which is taking over servletcontainer's builtin default servlet who is the one responsible for going to the right root path
your folder name is something which CF already have a mapping for e.g. /flashservices/gateway/, CFFormGateway, cfform-internal, WSRPProducer, JSDebugServlet, flex2gateway
I think sharing your web.xml could have helped pin point the issue here.
I had this issue recently and it was a case-sensitivity issue in Tomcat (despite this being a ColdFusion 10 install on Windows).
My default index.cfm would load when I navigated to http://127.0.0.1 but as soon as I went to http://127.0.0.1/mysite, I got a 404. The folder was named mySite in Windows. As soon as I changed my URL to http://127.0.0.1/mySite it began working.

Mercurial ignore part of a directory

Been fighting with Mercurial's .hgignore for a while under Windows.
I have a folder named Upload which is currently empty. I do want it tracked so I added a .empty file in it which work fine. I want this so that new developers doing an hg clone get the Upload document required for the application.
Thing is I never want the folder to be populated with anything on the source control itself (test uploads from a development machine).
Example:
If I add Public/image.jpg it wouldn't be tracked.
Additionally I would like it for sub directory to be tracked. So if developer adds
Upload/users/.empty I would like this to be tracked.
Is this possible with regex voodoo?
In mercurial (and unlike in svn and cvs) adding a file overrides the .hgignore file, so you can put this in your .hgignore:
^Uploads/.*
and your Upload/.empty that you added will still be created on update and thus they'll get the directory.
Getting it to ignore files in upload but not not ignore files in subdirectories in Upload could be done with:
^Uploads/[^/]*$
which says: ignore anything that Starts with Uploads and has no further slashes in it.
Really though, you should be creating Uploads with your build/install/configure script when possible, not with the clone/update.
Try putting
Uploads/(?!.empty)
in .hgignore in the root of the repository
Try
^Uploads\b.*/(?!\.empty)[^/]+$
This should match any path starting with Uploads where the text after the last slash (=filename) is anything but .empty.

Excluding a single project file from an SVN repository

I have a django project that I have been working on as a solo developer, and have been using TortoiseSVN to keep the code managed in a repository on a work server. I work on this on a local installation of django etc.
There is now a second person who will be working on this project, and the possibility of working on some other PCs.
Now, there should, for the time being, only be one development version (branch?) of this project, but the configuration file (settings.py) will need to be different on each computer that is being used. I want to create one local version of this file on each PC which should not need to be changed again.
How can I set the repository (preferably within TortoiseSVN) to exclude this one file? E.g. the repository should not include settings.py. When a checkout occurs, it should update all files in the local folder but not change/remove the local copy of settings.py. When a commit occurs, settings.py should be ignored and not uploaded.
At the moment settings.py is overwritten/updated as per any other file in the project folder/repository.
Any nudges in the right direction would be useful - I'm new to SVN generally and would like to know if this is something that's going to need detailed understanding of branching or if there is a simpler way.
Thanks
In TortoiseSVN, when you try to commit your files, in the file list dialog, right click the file and look for the Ignore option. You can ignore by complete filename or extension.
If the file is already in the repository, and you want to remove it from there and ignore it, you can simply right-click the file and in the TortoiseSVN menu look for the 'Delete and add to ignore list' option.
You'll be looking for the svn:ignore property, which tells subversion to not version files matching a pattern or patterns you specify.
There's some guidance on using it with TortoiseSVN at:
http://arcware.net/tortoisesvn-global-ignore-pattern-vs-svn-ignore/
These should help:
I have a file in my project that every developer must change, but I don't want those local mods to ever be committed. How can I make 'svn commit' ignore the file?
Excluding Items from the Commit List
The typical solution is to do what bgever said and ignore the settings file itself, and then commit a file with example values, something like settings.py.example. That file should only be updated when you add or remove settings. When deploying, you'd copy that to settings.py and edit the values.