Copy link to clipboard
Copied
Hey everyone. I have a process that needs to read a file, do some work with the contents, then move the file to either a fail or success folder. I have everything working except for the very last step where it deletes the files from the source dir. Also, the move command seems to be acting like copy (hence the reason I need a delete in the first place). I have tried inserting delays between the move and delete, and even putting the delete action in a while loop that would only break if it succeeded at deleting the file (page would time out). If you try and delete the file manually through windows explorer, it works just fine. This is a windows server 2003 box, CF is running with full permissions on this directory. Here is my code.
<cftry>
<cfif fileexists("\\fpiserver\company\processing\fail\#name#")>
<cffile action="delete" file="\\fpiserver\company\processing\fail\#name#">
</cfif>
<cfif fileexists("\\fpiserver\company\processing\#name#")>
<cffile action="move" source = "\\fpiserver\company\processing\#name#" destination = "\\fpiserver\company\processing\Fail\#name#" >
</cfif>
<cfif fileexists("\\fpiserver\company\processing\#name#")>
<cffile action="delete" file="\\fpiserver\company\processing\#name#">
</cfif>
<cfcatch type="any" >
Also could not delete file. #cfcatch.message#
</cfcatch>
</cftry>
I know your first thought is going to be the UNC paths, and you may be right, but the first delete and the move/copy work fine (basically). So I'm not sure that is it. I also tried applying the latest hotfix/patch. Thanks for any help.
Copy link to clipboard
Copied
Figured it out. The program that was creating the files was not releasing its threadlock on them. My bad.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more