FileMove failed error 1003

Started by croftab, October 05, 2015, 06:17:32 AM

Previous topic - Next topic

croftab

I have the following block of code in a script that fails on the FileMove command and returns error 1003

If FileItemize("%path%\Analytics*.txt") != ""
    fileList = FileItemize("%path%\Analytics*.txt")
    For i = 1 to ItemCount(fileList, @TAB)
        file = ItemExtract(i, fileList, @TAB)
        FileAttrSet("%path%\%file%", "rash")
        While FileExist("%path%\%file%") != 1
            Display(10, "ACE HB Clarity Extracts", StrCat("Waiting for file lock on '%path%\%file%' to be released. ", "Status: ", FileExist("%path%\%file%")))
        EndWhile
        FileMove("%path%\%file%", "%path%\archive", @FALSE)
    Next
EndIf


I've encountered similar behavior with FileCopy and successfully resolved by following suggestions in bullet 3 of this post: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+winbatch/Functions+FileCopy~Failure.txt

I'm not having the same luck with this issue. This script runs once a week and fails every time. If I clear the error and execute the above block of code it works. I thought it was an issue with the file being locked but I don't think it's the case now.

The path variable is a UNC path. The "More Error Info" button on the error dialog is greyed out or I would have posted the contents. Anyone have any suggestions on how to troubleshoot this further?

WinBatch 2007C

td

If you were using the latest version of WinBatch, the  "More Error Info" button  would not be greyed out and you would know what the system is complaining about via a system error code.  Since you don't have the error code you are left with speculation. 

Since you are working with shares, SMB caching is a likely candidate as the source of your problem.  One workaround might be to trap the error, pause the script using the TimeDelay function and then retry the move. 

Another approach might be to delete any existing files of the same name on the destination, perform a copy, and then delete the source file.   The FileMove function automagically deletes destination files for you but you may be able to use your FileCopy solution to workaround the issue.


For thoroughness's sake it should also mention that you can use FileMove to perform batch moves by using wildcards in both the source and the destination but this bit of info is obviously not likely to help solve your problem.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade