Cffile rename "Can't delete resource"

Trying a cffile rename on files on Windows Server (same server Lucee is running on).

It comes back with “Can’t delete resource” in Lucee. Interestingly, the first file was “renamed”, but the original is still there, and it gave the error before proceeding to the next file (cflooped on a list of specific files). Did Lucee perform a COPY?

Lucee can cffile COPY all those same files without issue, but I don’t want that.

What kind of permissions does the Lucee process need to be granted to be able to rename files? None of them have the read-only (or hidden, etc.) attribute.

I’m able to cffile WRITE and DELETE a new file Lucee creates in that same directory without issues.

Any help is appreciated!

@dlegate cffile action rename and move actually does rename the file by using the renameTo() method from the java.io.File class File (Java Platform SE 7 ).

If the renameTo() is not successful then lucee trying to complete the rename process by just copying the file to the destination and deleting the original file. In your case that deleting the original file were failed maybe by the original file was used by another process or other some reasons.

Thank you so much for that explanation, cfmitrah! It helps to know the underlying processes.

For future reference, and anyone having the same issue, what it turned out to be is Windows Folder level Security Permissions.

Had to allow the Users group Modify permissions on the folder they were in:

lucee_win_folder_perms

I’m wondering what “User” the Lucee process runs in on Windows Server?

Funny enough, I don’t even see any Lucee-named Processes in the Windows Services list. I know this probably should be in a new thread (and I may do that), but does anyone know what process(es) actually run the Lucee instance on a Windows Server?

Thanks!

2 Likes

Answer to my “wondering” what the Lucee Service Name is in Windows:

Apache Tomcat 9.0 Lucee

at least with my current Lucee 5.3.9.141 installation.

As for the Windows Process/Task list, it runs as a sub-process under:

Apache Commons Daemon Service Runner

Dan