Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Simple File Operation Problems

Guest
May 04, 2010 May 04, 2010

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.

336
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 04, 2010 May 04, 2010
LATEST

Figured it out. The program that was creating the files was not releasing its threadlock on them. My bad.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources